Changeset 7962


Ignore:
Timestamp:
Jun 4, 2021, 12:40:45 PM (18 months ago)
Author:
Nicklas Nordborg
Message:

References #2250: Named transactions

Added a name to several transaction within the core. The remaining unnamed transaction are from plug-ins, but it is better to leave them as they are since the default name generation will create a good name.

Location:
trunk/src
Files:
25 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/clients/jobagent/net/sf/basedb/clients/jobagent/Agent.java

    r7899 r7962  
    916916    {
    917917      // Reload job and impersonate the owner
    918       dc = sc.newDbControl();
     918      dc = sc.newDbControl("Job agent: Impersonate");
    919919      job = Job.getById(dc, job.getId());
    920920      impersonated = sc.impersonateLogin(job, "Running job: " + job.getName());
     
    927927        try
    928928        {
    929           dc = impersonated.newDbControl();
     929          dc = impersonated.newDbControl("Jb agent: Impersonate");
    930930          Project activeProject = Project.getById(dc, projectId);
    931931          impersonated.setActiveProject(activeProject);
  • trunk/src/clients/jobagent/net/sf/basedb/clients/jobagent/AgentController.java

    r6444 r7962  
    378378    try
    379379    {
    380       dc = sc.newDbControl();
     380      dc = sc.newDbControl("Job agent: Register");
    381381      JobAgent jobAgent = null;
    382382      try
     
    409409    try
    410410    {
    411       dc = sc.newDbControl();
     411      dc = sc.newDbControl("Job agent: Unregister");
    412412      JobAgent jobAgent = null;
    413413      try
  • trunk/src/clients/jobagent/net/sf/basedb/clients/jobagent/JobQueueChecker.java

    r6444 r7962  
    7777    {
    7878      SessionControl sc = agent.getSessionControl();
    79       dc = sc.newDbControl();
     79      dc = sc.newDbControl("Job agent");
    8080      agent.getJobAgent(dc);
    8181    }
     
    110110    {
    111111      SessionControl sc = agent.getSessionControl();
    112       dc = sc.newDbControl();
     112      dc = sc.newDbControl(": Check for jobs");
    113113      JobAgent jobAgent = agent.getJobAgent(dc);
    114114     
  • trunk/src/clients/jobagent/net/sf/basedb/clients/jobagent/JobRunner.java

    r6444 r7962  
    9999      // Log in as the owner of the job
    100100      sc = agent.getImpersonatedSessionControl(job);
    101       dc = sc.newDbControl();
     101      dc = sc.newDbControl("Job agent: Prepare job");
    102102     
    103103      // Load a fresh copy of the job
     
    129129      {
    130130        // Something went wrong, update status to ERROR
    131         dc = sc.newDbControl();
     131        dc = sc.newDbControl("Job agent: Job error");
    132132        j = Job.getById(dc, j.getId());
    133133        j.doneError(t.getMessage(), Arrays.asList(t));
     
    141141     
    142142      // Check that that the status has changed from prepared
    143       dc = sc.newDbControl();
     143      dc = sc.newDbControl("Job agent: Job ended");
    144144      j = Job.getById(dc, j.getId());
    145145      if (j.getStatus() == Job.Status.PREPARED)
  • trunk/src/clients/jobagent/net/sf/basedb/clients/jobagent/executors/DummyJobExecutor.java

    r6881 r7962  
    101101    try
    102102    {
    103       dc = sc.newDbControl();
     103      dc = sc.newDbControl("Dummy job agent: Run job");
    104104      job = Job.getById(dc, job.getId());
    105105      job.start("Not really, but used for testing the job agent",
     
    128128          error = t;
    129129        }
    130         dc  = sc.newDbControl();
     130        dc  = sc.newDbControl("Dummy job agent: Job ended");
    131131        dc.reattachItem(job, false);
    132132      }
  • trunk/src/clients/jobagent/net/sf/basedb/clients/jobagent/executors/ProcessJobExecutor.java

    r6881 r7962  
    182182    {
    183183      // Update progress on job
    184       dc = sc.newDbControl();
     184      dc = sc.newDbControl("Job agent: Run job");
    185185      job = Job.getById(dc, job.getId());
    186186      job.setProgress(0, "Starting new process");
     
    201201      {
    202202        log.error("Error executing job: " + job, t);
    203         dc = sc.newDbControl();
     203        dc = sc.newDbControl("Job agent: Job error");
    204204        job = Job.getById(dc, job.getId());
    205205        job.doneError(t.getMessage(), Arrays.asList(t));
     
    225225          log.error("Process ended with exit code: " + exitCode);
    226226          log.error("Process output is: " + result.toString());
    227           dc = sc.newDbControl();
     227          dc = sc.newDbControl("Job agent: Job error");
    228228          job = Job.getById(dc, job.getId());
    229229          job.doneError("Job ended with exit code: " + exitCode,
     
    240240        log.info("Job was interrupted (job agent is shutting down): " + job, ex);
    241241        // First, send SHUTDOWN/ABORT to the job if it supports it
    242         dc = sc.newDbControl();
     242        dc = sc.newDbControl("Job agent: Job interrupted");
    243243        job = Job.getById(dc, job.getId());
    244244        SignalTransporter signalTransporter = job.getSignalTransporter();
  • trunk/src/clients/jobagent/net/sf/basedb/clients/jobagent/executors/ThreadJobExecutor.java

    r6444 r7962  
    8989    try
    9090    {
    91       dc = sc.newDbControl();
     91      dc = sc.newDbControl("Job agent: Run job");
    9292     
    9393      // Load a fresh copy of the job item and settings
     
    181181      loginRequest.setComment(loginComment);
    182182      sc.login(loginRequest);
    183       dc = sc.newDbControl();
     183      dc = sc.newDbControl("Job agent: Run job");
    184184      Job job = Job.getById(dc, jobId);
    185185      JobAgentSettings settings = JobAgentSettings.getById(dc, settingsId);
     
    190190      if (projectId != 0)
    191191      {
    192         dc = impersonated.newDbControl();
     192        dc = impersonated.newDbControl("Job agent: Run job");
    193193        try
    194194        {
  • trunk/src/clients/web/net/sf/basedb/clients/web/Base.java

    r7895 r7962  
    707707              if (unitId != 0)
    708708              {
    709                 DbControl dc = sc.newDbControl();
     709                DbControl dc = sc.newDbControl("Load unit");
    710710                try
    711711                {
  • trunk/src/clients/web/net/sf/basedb/clients/web/extensions/list/RelatedItemHelper.java

    r7840 r7962  
    7171      }
    7272     
    73       dc = sc.newDbControl();
     73      dc = sc.newDbControl(":Load releated items");
    7474      transformContext = new TransformContext(dc);
    7575      manager.clear();
  • trunk/src/clients/web/net/sf/basedb/clients/web/servlet/Download.java

    r7714 r7962  
    186186      }
    187187      File f = null;
    188       dc = sc.newDbControl();
     188      dc = sc.newDbControl(download ? ":Download file" : ":View file");
    189189      f = File.getByPath(dc, path, false);
    190190      in = f.getDownloadStream(startByte);
  • trunk/src/clients/web/net/sf/basedb/clients/web/servlet/ExperimentExplorerPlotServlet.java

    r7159 r7962  
    190190      try
    191191      {
    192         dc = sc.newDbControl();
     192        dc = sc.newDbControl("Experiment explorer plot");
    193193        final BioAssaySet bioAssaySet = BioAssaySet.getById(dc, bioassaySetId);
    194194        final ExperimentExplorer explorer = ExperimentExplorer.getExplorer(bioAssaySet);
  • trunk/src/clients/web/net/sf/basedb/clients/web/servlet/PlotServlet.java

    r7703 r7962  
    394394          // Only reload the image if there is no cached version
    395395          final SessionControl sc = Application.getSessionControl(ID, Base.WEBCLIENT_ID, request.getRemoteAddr(), true);
    396           dc = sc.newDbControl();
     396          dc = sc.newDbControl("Plot servlet");
    397397          BioAssay ba = bioAssayId == 0 ? null : BioAssay.getById(dc, bioAssayId);
    398398          BioAssaySet bas = ba == null ? BioAssaySet.getById(dc, bioAssaySetId) : ba.getBioAssaySet();
  • trunk/src/clients/web/net/sf/basedb/clients/web/servlet/RssNewsFeed.java

    r7714 r7962  
    168168    {
    169169      sc = Application.newSessionControl(Base.WEBCLIENT_ID, null, null);
    170       dc = sc.newDbControl();
     170      dc = sc.newDbControl(":RSS News feed");
    171171     
    172172      about = sc.getClientDefaultSetting("server.about");
  • trunk/src/clients/web/net/sf/basedb/clients/web/servlet/Upload.java

    r7703 r7962  
    108108     
    109109      // Check that the user is allowed to create files in the given directory
    110       dc = sc.newDbControl();
     110      dc = sc.newDbControl(":File upload");
    111111      final Directory directory = Directory.getById(dc, directoryId);
    112112      directory.checkPermission(Permission.USE);
  • trunk/src/core/net/sf/basedb/core/InternalJobQueue.java

    r7513 r7962  
    320320    try
    321321    {
    322       dc = sc.newDbControl();
     322      dc = sc.newDbControl("Internal job queue: Check for jobs");
    323323      String hqlName = ignoreUseInternalJobQueueFlag ?
    324324        "FIND_JOBS_IN_QUEUE" : "FIND_INTERNAL_JOBS_IN_QUEUE";
     
    398398    try
    399399    {
    400       dc = sc.newDbControl();
     400      dc = sc.newDbControl("Internal job queue: Request status update");
    401401     
    402402      org.hibernate.query.Query<JobData> query =
     
    453453    try
    454454    {
    455       dc = impersonated.newDbControl();
     455      dc = impersonated.newDbControl("Internal job queue: Send error message");
    456456      Job job = Job.getById(dc, jobId);
    457457      job.doneError(ex.getMessage(), Arrays.asList(ex));
     
    513513        // Log in as the owner of the job
    514514        SessionControl impersonated = sc.impersonateLogin(ownerId, "Running job " + getJob());
    515         dc = impersonated.newDbControl();
     515        dc = impersonated.newDbControl("Internal job queue: Prepare job");
    516516        job = Job.getById(dc, jobId);
    517517       
     
    537537        // Now we know that noby else is trying to execute the job
    538538        // Reload the job again in a new DbControl
    539         dc = impersonated.newDbControl();
     539        dc = impersonated.newDbControl("Internal job queue: Run job");
    540540        job = Job.getById(dc, jobId);
    541541       
  • trunk/src/core/net/sf/basedb/core/Job.java

    r7889 r7962  
    19451945        try
    19461946        {
    1947           dc = sc.newDbControl();
     1947          dc = sc.newDbControl("Progress update");
    19481948          updateProgress(dc.getHibernateSession(), percent, message);
    19491949          dc.commit();
     
    19721972        try
    19731973        {
    1974           dc = sc.newDbControl();
     1974          dc = sc.newDbControl("Progress update");
    19751975          appendProgress(dc.getHibernateSession(), message);
    19761976          dc.commit();
     
    20332033      try
    20342034      {
    2035         dc = sc.newDbControl();
     2035        dc = sc.newDbControl("Starting job");
    20362036        Job job = jobId == 0 ? this.job : Job.getById(dc, jobId);
    20372037        if (signalTransporter != null && signalId != null)
     
    20572057      try
    20582058      {
    2059         dc = sc.newDbControl();
     2059        dc = sc.newDbControl("Job ended");
    20602060        Job job = jobId == 0 ? this.job : Job.getById(dc, jobId);
    20612061        job.getData().setDryRun(response.isDryRun());
  • trunk/src/core/net/sf/basedb/core/SessionControl.java

    r7961 r7962  
    531531      name = "Unknown";
    532532    }
    533    
    534    
    535     ThreadLocal<String> activeClient = new ThreadLocal<>();
    536    
    537533    return name;
    538534  }
  • trunk/src/core/net/sf/basedb/core/Trashcan.java

    r7381 r7962  
    244244      {
    245245        ThreadSignalHandler.checkInterrupted();
    246         dc = sc2.newDbControl();
     246        dc = sc2.newDbControl("Trashcan: Delete items");
    247247        log.debug("Start new delete transaction");
    248248        try
     
    360360  public static int deleteAll(SessionControl sc, ProgressReporter progress)
    361361  {
    362     DbControl dc = sc.newDbControl();
     362    DbControl dc = sc.newDbControl("Trashcan: Delete items");
    363363    try
    364364    {
     
    377377    if (isDebug) log.debug("Trying to break circular references: " + itemsToRemove);
    378378   
    379     DbControl dc = sc.newDbControl();
     379    DbControl dc = sc.newDbControl("Trashcan: break circular references");
    380380    int circularRefsBroken = 0;
    381381    try
  • trunk/src/core/net/sf/basedb/core/plugin/AbstractPlugin.java

    r7714 r7962  
    374374    if (logfile != null || path == null) return;
    375375   
    376     logDc = sc.newDbControl();
     376    logDc = sc.newDbControl("Create log file");
    377377    try
    378378    {
  • trunk/src/core/net/sf/basedb/util/annotations/RunnableInheritAnnotationsManager.java

    r7610 r7962  
    109109    try
    110110    {
    111       dc = sc.newDbControl();
     111      dc = sc.newDbControl(":Batch inherit annotations");
    112112      InheritAnnotationsManager manager = new InheritAnnotationsManager(dc, new SnapshotManager(), specifications);
    113113     
  • trunk/src/plugins/core/net/sf/basedb/plugins/PluginConfigurationImporter.java

    r7714 r7962  
    344344    try
    345345    {
    346       dc = sc.newDbControl();     
     346      dc = sc.newDbControl(":Plug-in configuration importer");     
    347347      String filePath = null;
    348348      if (xmlFile != null)
  • trunk/src/plugins/core/net/sf/basedb/plugins/RawDataFlatFileImporter.java

    r7668 r7962  
    606606      rawBioAssays = new ArrayList<RawBioAssay>();
    607607      files = new ArrayList<File>();
    608       DbControl dc = sc.newDbControl();
     608      DbControl dc = sc.newDbControl("Raw data importer");
    609609      try
    610610      {
  • trunk/src/test/PermissionPlugin.java

    r6127 r7962  
    127127  private void createNews(String description)
    128128  {
    129     DbControl dc = sc.newDbControl();
     129    DbControl dc = sc.newDbControl("Test: Permission plugin");
    130130    try
    131131    {
     
    144144  private void exportNews(int numNews)
    145145  {
    146     DbControl dc = sc.newDbControl();
     146    DbControl dc = sc.newDbControl("Test: Permission plugin");
    147147    try
    148148    {
  • trunk/src/test/TestUtil.java

    r7899 r7962  
    126126    throws BaseException
    127127  {
    128     DbControl dc = sc.newDbControl();
     128    DbControl dc = sc.newDbControl("Test");
    129129    return dc;
    130130  }
  • trunk/src/test/net/sf/basedb/test/TestUtil.java

    r7899 r7962  
    163163      {}
    164164    }
    165     return getSessionControl().newDbControl();
     165    return getSessionControl().newDbControl("Test");
    166166  }
    167167
Note: See TracChangeset for help on using the changeset viewer.