incubator-connectors-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1331102 - in /incubator/lcf/trunk: CHANGES.txt framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobManager.java framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/Jobs.java
Date Thu, 26 Apr 2012 21:15:28 GMT
Author: kwright
Date: Thu Apr 26 21:15:27 2012
New Revision: 1331102

URL: http://svn.apache.org/viewvc?rev=1331102&view=rev
Log:
Fix for CONNECTORS-453.  Derby's locking has changed somewhat and we now need to retry pause
and abort commands sometimes.

Modified:
    incubator/lcf/trunk/CHANGES.txt
    incubator/lcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobManager.java
    incubator/lcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/Jobs.java

Modified: incubator/lcf/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/CHANGES.txt?rev=1331102&r1=1331101&r2=1331102&view=diff
==============================================================================
--- incubator/lcf/trunk/CHANGES.txt (original)
+++ incubator/lcf/trunk/CHANGES.txt Thu Apr 26 21:15:27 2012
@@ -3,6 +3,10 @@ $Id$
 
 ======================= 0.6-dev =====================
 
+CONNECTORS-453: Getting deadlock problems and other issues with
+Derby 10.8.1.1.
+(Karl Wright)
+
 CONNECTORS-467: Remove outdated taglib directives in web.xml
 (Erlend GarĂ¥sen)
 

Modified: incubator/lcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobManager.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobManager.java?rev=1331102&r1=1331101&r2=1331102&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobManager.java
(original)
+++ incubator/lcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobManager.java
Thu Apr 26 21:15:27 2012
@@ -5188,7 +5188,39 @@ public class JobManager implements IJobM
     {
       Logging.jobs.debug("Manually aborting job "+jobID);
     }
-    jobs.abortJob(jobID,null);
+    while (true)
+    {
+      long sleepAmt = 0L;
+      database.beginTransaction();
+      try
+      {
+        jobs.abortJob(jobID,null);
+        database.performCommit();
+        break;
+      }
+      catch (ManifoldCFException e)
+      {
+        database.signalRollback();
+        if (e.getErrorCode() == e.DATABASE_TRANSACTION_ABORT)
+        {
+          if (Logging.perf.isDebugEnabled())
+            Logging.perf.debug("Aborted transaction aborting job: "+e.getMessage());
+          sleepAmt = getRandomAmount();
+          continue;
+        }
+        throw e;
+      }
+      catch (Error e)
+      {
+        database.signalRollback();
+        throw e;
+      }
+      finally
+      {
+        database.endTransaction();
+        sleepFor(sleepAmt);
+      }
+    }
     if (Logging.jobs.isDebugEnabled())
     {
       Logging.jobs.debug("Job "+jobID+" abort signal successfully sent");
@@ -5206,7 +5238,39 @@ public class JobManager implements IJobM
     {
       Logging.jobs.debug("Manually restarting job "+jobID);
     }
-    jobs.abortRestartJob(jobID);
+    while (true)
+    {
+      long sleepAmt = 0L;
+      database.beginTransaction();
+      try
+      {
+        jobs.abortRestartJob(jobID);
+        database.performCommit();
+        break;
+      }
+      catch (ManifoldCFException e)
+      {
+        database.signalRollback();
+        if (e.getErrorCode() == e.DATABASE_TRANSACTION_ABORT)
+        {
+          if (Logging.perf.isDebugEnabled())
+            Logging.perf.debug("Aborted transaction restarting job: "+e.getMessage());
+          sleepAmt = getRandomAmount();
+          continue;
+        }
+        throw e;
+      }
+      catch (Error e)
+      {
+        database.signalRollback();
+        throw e;
+      }
+      finally
+      {
+        database.endTransaction();
+        sleepFor(sleepAmt);
+      }
+    }
     if (Logging.jobs.isDebugEnabled())
     {
       Logging.jobs.debug("Job "+jobID+" restart signal successfully sent");
@@ -5227,7 +5291,40 @@ public class JobManager implements IJobM
     {
       Logging.jobs.debug("Aborting job "+jobID+" due to error '"+errorText+"'");
     }
-    boolean rval = jobs.abortJob(jobID,errorText);
+    boolean rval;
+    while (true)
+    {
+      long sleepAmt = 0L;
+      database.beginTransaction();
+      try
+      {
+        rval = jobs.abortJob(jobID,errorText);
+        database.performCommit();
+        break;
+      }
+      catch (ManifoldCFException e)
+      {
+        database.signalRollback();
+        if (e.getErrorCode() == e.DATABASE_TRANSACTION_ABORT)
+        {
+          if (Logging.perf.isDebugEnabled())
+            Logging.perf.debug("Aborted transaction aborting job: "+e.getMessage());
+          sleepAmt = getRandomAmount();
+          continue;
+        }
+        throw e;
+      }
+      catch (Error e)
+      {
+        database.signalRollback();
+        throw e;
+      }
+      finally
+      {
+        database.endTransaction();
+        sleepFor(sleepAmt);
+      }
+    }
     if (rval && Logging.jobs.isDebugEnabled())
     {
       Logging.jobs.debug("Job "+jobID+" abort signal successfully sent");
@@ -5245,7 +5342,40 @@ public class JobManager implements IJobM
     {
       Logging.jobs.debug("Manually pausing job "+jobID);
     }
-    jobs.pauseJob(jobID);
+    while (true)
+    {
+      long sleepAmt = 0L;
+      database.beginTransaction();
+      try
+      {
+        jobs.pauseJob(jobID);
+        database.performCommit();
+        break;
+      }
+      catch (ManifoldCFException e)
+      {
+        database.signalRollback();
+        if (e.getErrorCode() == e.DATABASE_TRANSACTION_ABORT)
+        {
+          if (Logging.perf.isDebugEnabled())
+            Logging.perf.debug("Aborted transaction pausing job: "+e.getMessage());
+          sleepAmt = getRandomAmount();
+          continue;
+        }
+        throw e;
+      }
+      catch (Error e)
+      {
+        database.signalRollback();
+        throw e;
+      }
+      finally
+      {
+        database.endTransaction();
+        sleepFor(sleepAmt);
+      }
+    }
+
     if (Logging.jobs.isDebugEnabled())
     {
       Logging.jobs.debug("Job "+jobID+" successfully paused");
@@ -5263,26 +5393,39 @@ public class JobManager implements IJobM
     {
       Logging.jobs.debug("Manually restarting paused job "+jobID);
     }
-
-    database.beginTransaction();
-    try
-    {
-      jobs.restartJob(jobID);
-      jobQueue.clearFailTimes(jobID);
-    }
-    catch (ManifoldCFException e)
-    {
-      database.signalRollback();
-      throw e;
-    }
-    catch (Error e)
-    {
-      database.signalRollback();
-      throw e;
-    }
-    finally
+    while (true)
     {
-      database.endTransaction();
+      long sleepAmt = 0L;
+      database.beginTransaction();
+      try
+      {
+        jobs.restartJob(jobID);
+        jobQueue.clearFailTimes(jobID);
+        database.performCommit();
+        break;
+      }
+      catch (ManifoldCFException e)
+      {
+        database.signalRollback();
+        if (e.getErrorCode() == e.DATABASE_TRANSACTION_ABORT)
+        {
+          if (Logging.perf.isDebugEnabled())
+            Logging.perf.debug("Aborted transaction restarting pausing job: "+e.getMessage());
+          sleepAmt = getRandomAmount();
+          continue;
+        }
+        throw e;
+      }
+      catch (Error e)
+      {
+        database.signalRollback();
+        throw e;
+      }
+      finally
+      {
+        database.endTransaction();
+        sleepFor(sleepAmt);
+      }
     }
 
     if (Logging.jobs.isDebugEnabled())

Modified: incubator/lcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/Jobs.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/Jobs.java?rev=1331102&r1=1331101&r2=1331102&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/Jobs.java
(original)
+++ incubator/lcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/Jobs.java
Thu Apr 26 21:15:27 2012
@@ -1656,79 +1656,61 @@ public class Jobs extends org.apache.man
   public boolean abortJob(Long jobID, String errorText)
     throws ManifoldCFException
   {
-    beginTransaction();
-    try
-    {
-      // Get the current job status
-      ArrayList list = new ArrayList();
-      String query = buildConjunctionClause(list,new ClauseDescription[]{
-        new UnitaryClause(idField,jobID)});
-      IResultSet set = performQuery("SELECT "+statusField+" FROM "+getTableName()+
-        " WHERE "+query+" FOR UPDATE",list,null,null);
-      if (set.getRowCount() == 0)
-        throw new ManifoldCFException("Job does not exist: "+jobID);
-      IResultRow row = set.getRow(0);
-      int status = stringToStatus(row.getValue(statusField).toString());
-      if (status == STATUS_ABORTING || status == STATUS_ABORTINGSEEDING || status == STATUS_ABORTINGSTARTINGUP)
-        return false;
-      int newStatus;
-      switch (status)
-      {
-      case STATUS_STARTINGUP:
-      case STATUS_ABORTINGSTARTINGUPFORRESTART:
-        newStatus = STATUS_ABORTINGSTARTINGUP;
-        break;
-      case STATUS_READYFORSTARTUP:
-      case STATUS_ACTIVE:
-      case STATUS_ACTIVE_UNINSTALLED:
-      case STATUS_ACTIVE_NOOUTPUT:
-      case STATUS_ACTIVE_NEITHER:
-      case STATUS_ACTIVEWAIT:
-      case STATUS_PAUSING:
-      case STATUS_ACTIVEWAITING:
-      case STATUS_PAUSINGWAITING:
-      case STATUS_PAUSED:
-      case STATUS_PAUSEDWAIT:
-      case STATUS_ABORTINGFORRESTART:
-        newStatus = STATUS_ABORTING;
-        break;
-      case STATUS_ACTIVESEEDING:
-      case STATUS_ACTIVESEEDING_UNINSTALLED:
-      case STATUS_ACTIVESEEDING_NOOUTPUT:
-      case STATUS_ACTIVESEEDING_NEITHER:
-      case STATUS_ACTIVEWAITSEEDING:
-      case STATUS_PAUSINGSEEDING:
-      case STATUS_ACTIVEWAITINGSEEDING:
-      case STATUS_PAUSINGWAITINGSEEDING:
-      case STATUS_PAUSEDSEEDING:
-      case STATUS_PAUSEDWAITSEEDING:
-      case STATUS_ABORTINGFORRESTARTSEEDING:
-        newStatus = STATUS_ABORTINGSEEDING;
-        break;
-      default:
-        throw new ManifoldCFException("Job "+jobID+" is not active");
-      }
-      // Pause the job
-      HashMap map = new HashMap();
-      map.put(statusField,statusToString(newStatus));
-      map.put(errorField,errorText);
-      performUpdate(map,"WHERE "+query,list,new StringSet(getJobStatusKey()));
-      return true;
-    }
-    catch (ManifoldCFException e)
-    {
-      signalRollback();
-      throw e;
-    }
-    catch (Error e)
-    {
-      signalRollback();
-      throw e;
-    }
-    finally
+    // Get the current job status
+    ArrayList list = new ArrayList();
+    String query = buildConjunctionClause(list,new ClauseDescription[]{
+      new UnitaryClause(idField,jobID)});
+    IResultSet set = performQuery("SELECT "+statusField+" FROM "+getTableName()+
+      " WHERE "+query+" FOR UPDATE",list,null,null);
+    if (set.getRowCount() == 0)
+      throw new ManifoldCFException("Job does not exist: "+jobID);
+    IResultRow row = set.getRow(0);
+    int status = stringToStatus(row.getValue(statusField).toString());
+    if (status == STATUS_ABORTING || status == STATUS_ABORTINGSEEDING || status == STATUS_ABORTINGSTARTINGUP)
+      return false;
+    int newStatus;
+    switch (status)
     {
-      endTransaction();
+    case STATUS_STARTINGUP:
+    case STATUS_ABORTINGSTARTINGUPFORRESTART:
+      newStatus = STATUS_ABORTINGSTARTINGUP;
+      break;
+    case STATUS_READYFORSTARTUP:
+    case STATUS_ACTIVE:
+    case STATUS_ACTIVE_UNINSTALLED:
+    case STATUS_ACTIVE_NOOUTPUT:
+    case STATUS_ACTIVE_NEITHER:
+    case STATUS_ACTIVEWAIT:
+    case STATUS_PAUSING:
+    case STATUS_ACTIVEWAITING:
+    case STATUS_PAUSINGWAITING:
+    case STATUS_PAUSED:
+    case STATUS_PAUSEDWAIT:
+    case STATUS_ABORTINGFORRESTART:
+      newStatus = STATUS_ABORTING;
+      break;
+    case STATUS_ACTIVESEEDING:
+    case STATUS_ACTIVESEEDING_UNINSTALLED:
+    case STATUS_ACTIVESEEDING_NOOUTPUT:
+    case STATUS_ACTIVESEEDING_NEITHER:
+    case STATUS_ACTIVEWAITSEEDING:
+    case STATUS_PAUSINGSEEDING:
+    case STATUS_ACTIVEWAITINGSEEDING:
+    case STATUS_PAUSINGWAITINGSEEDING:
+    case STATUS_PAUSEDSEEDING:
+    case STATUS_PAUSEDWAITSEEDING:
+    case STATUS_ABORTINGFORRESTARTSEEDING:
+      newStatus = STATUS_ABORTINGSEEDING;
+      break;
+    default:
+      throw new ManifoldCFException("Job "+jobID+" is not active");
     }
+    // Pause the job
+    HashMap map = new HashMap();
+    map.put(statusField,statusToString(newStatus));
+    map.put(errorField,errorText);
+    performUpdate(map,"WHERE "+query,list,new StringSet(getJobStatusKey()));
+    return true;
   }
 
   /** Restart a job.  Finish off what's currently happening, and then start the job up again.
@@ -1737,74 +1719,56 @@ public class Jobs extends org.apache.man
   public void abortRestartJob(Long jobID)
     throws ManifoldCFException
   {
-    beginTransaction();
-    try
-    {
-      // Get the current job status
-      ArrayList list = new ArrayList();
-      String query = buildConjunctionClause(list,new ClauseDescription[]{
-        new UnitaryClause(idField,jobID)});
-      IResultSet set = performQuery("SELECT "+statusField+" FROM "+getTableName()+
-        " WHERE "+query+" FOR UPDATE",list,null,null);
-      if (set.getRowCount() == 0)
-        throw new ManifoldCFException("Job does not exist: "+jobID);
-      IResultRow row = set.getRow(0);
-      int status = stringToStatus(row.getValue(statusField).toString());
-      if (status == STATUS_ABORTINGFORRESTART || status == STATUS_ABORTINGFORRESTARTSEEDING
|| status == STATUS_ABORTINGSTARTINGUPFORRESTART)
-        return;
-      int newStatus;
-      switch (status)
-      {
-      case STATUS_STARTINGUP:
-        newStatus = STATUS_ABORTINGSTARTINGUPFORRESTART;
-        break;
-      case STATUS_READYFORSTARTUP:
-      case STATUS_ACTIVE:
-      case STATUS_ACTIVE_UNINSTALLED:
-      case STATUS_ACTIVE_NOOUTPUT:
-      case STATUS_ACTIVE_NEITHER:
-      case STATUS_ACTIVEWAIT:
-      case STATUS_PAUSING:
-      case STATUS_ACTIVEWAITING:
-      case STATUS_PAUSINGWAITING:
-      case STATUS_PAUSED:
-      case STATUS_PAUSEDWAIT:
-        newStatus = STATUS_ABORTINGFORRESTART;
-        break;
-      case STATUS_ACTIVESEEDING:
-      case STATUS_ACTIVESEEDING_UNINSTALLED:
-      case STATUS_ACTIVESEEDING_NOOUTPUT:
-      case STATUS_ACTIVESEEDING_NEITHER:
-      case STATUS_ACTIVEWAITSEEDING:
-      case STATUS_PAUSINGSEEDING:
-      case STATUS_ACTIVEWAITINGSEEDING:
-      case STATUS_PAUSINGWAITINGSEEDING:
-      case STATUS_PAUSEDSEEDING:
-      case STATUS_PAUSEDWAITSEEDING:
-        newStatus = STATUS_ABORTINGFORRESTARTSEEDING;
-        break;
-      default:
-        throw new ManifoldCFException("Job "+jobID+" is not restartable");
-      }
-      // reset the job
-      HashMap map = new HashMap();
-      map.put(statusField,statusToString(newStatus));
-      performUpdate(map,"WHERE "+query,list,new StringSet(getJobStatusKey()));
-    }
-    catch (ManifoldCFException e)
-    {
-      signalRollback();
-      throw e;
-    }
-    catch (Error e)
-    {
-      signalRollback();
-      throw e;
-    }
-    finally
+    // Get the current job status
+    ArrayList list = new ArrayList();
+    String query = buildConjunctionClause(list,new ClauseDescription[]{
+      new UnitaryClause(idField,jobID)});
+    IResultSet set = performQuery("SELECT "+statusField+" FROM "+getTableName()+
+      " WHERE "+query+" FOR UPDATE",list,null,null);
+    if (set.getRowCount() == 0)
+      throw new ManifoldCFException("Job does not exist: "+jobID);
+    IResultRow row = set.getRow(0);
+    int status = stringToStatus(row.getValue(statusField).toString());
+    if (status == STATUS_ABORTINGFORRESTART || status == STATUS_ABORTINGFORRESTARTSEEDING
|| status == STATUS_ABORTINGSTARTINGUPFORRESTART)
+      return;
+    int newStatus;
+    switch (status)
     {
-      endTransaction();
+    case STATUS_STARTINGUP:
+      newStatus = STATUS_ABORTINGSTARTINGUPFORRESTART;
+      break;
+    case STATUS_READYFORSTARTUP:
+    case STATUS_ACTIVE:
+    case STATUS_ACTIVE_UNINSTALLED:
+    case STATUS_ACTIVE_NOOUTPUT:
+    case STATUS_ACTIVE_NEITHER:
+    case STATUS_ACTIVEWAIT:
+    case STATUS_PAUSING:
+    case STATUS_ACTIVEWAITING:
+    case STATUS_PAUSINGWAITING:
+    case STATUS_PAUSED:
+    case STATUS_PAUSEDWAIT:
+      newStatus = STATUS_ABORTINGFORRESTART;
+      break;
+    case STATUS_ACTIVESEEDING:
+    case STATUS_ACTIVESEEDING_UNINSTALLED:
+    case STATUS_ACTIVESEEDING_NOOUTPUT:
+    case STATUS_ACTIVESEEDING_NEITHER:
+    case STATUS_ACTIVEWAITSEEDING:
+    case STATUS_PAUSINGSEEDING:
+    case STATUS_ACTIVEWAITINGSEEDING:
+    case STATUS_PAUSINGWAITINGSEEDING:
+    case STATUS_PAUSEDSEEDING:
+    case STATUS_PAUSEDWAITSEEDING:
+      newStatus = STATUS_ABORTINGFORRESTARTSEEDING;
+      break;
+    default:
+      throw new ManifoldCFException("Job "+jobID+" is not restartable");
     }
+    // reset the job
+    HashMap map = new HashMap();
+    map.put(statusField,statusToString(newStatus));
+    performUpdate(map,"WHERE "+query,list,new StringSet(getJobStatusKey()));
   }
 
   /** Pause a job.
@@ -1813,68 +1777,50 @@ public class Jobs extends org.apache.man
   public void pauseJob(Long jobID)
     throws ManifoldCFException
   {
-    beginTransaction();
-    try
-    {
-      // Get the current job status
-      ArrayList list = new ArrayList();
-      String query = buildConjunctionClause(list,new ClauseDescription[]{
-        new UnitaryClause(idField,jobID)});
-      IResultSet set = performQuery("SELECT "+statusField+" FROM "+getTableName()+
-        " WHERE "+query+" FOR UPDATE",list,null,null);
-      if (set.getRowCount() == 0)
-        throw new ManifoldCFException("Job does not exist: "+jobID);
-      IResultRow row = set.getRow(0);
-      int status = stringToStatus(row.getValue(statusField).toString());
-      int newStatus;
-      switch (status)
-      {
-      case STATUS_ACTIVE:
-      case STATUS_ACTIVE_UNINSTALLED:
-      case STATUS_ACTIVE_NOOUTPUT:
-      case STATUS_ACTIVE_NEITHER:
-        newStatus = STATUS_PAUSING;
-        break;
-      case STATUS_ACTIVEWAITING:
-        newStatus = STATUS_PAUSINGWAITING;
-        break;
-      case STATUS_ACTIVEWAIT:
-        newStatus = STATUS_PAUSEDWAIT;
-        break;
-      case STATUS_ACTIVESEEDING:
-      case STATUS_ACTIVESEEDING_UNINSTALLED:
-      case STATUS_ACTIVESEEDING_NOOUTPUT:
-      case STATUS_ACTIVESEEDING_NEITHER:
-        newStatus = STATUS_PAUSINGSEEDING;
-        break;
-      case STATUS_ACTIVEWAITINGSEEDING:
-        newStatus = STATUS_PAUSINGWAITINGSEEDING;
-        break;
-      case STATUS_ACTIVEWAITSEEDING:
-        newStatus = STATUS_PAUSEDWAITSEEDING;
-        break;
-      default:
-        throw new ManifoldCFException("Job "+jobID+" is not active");
-      }
-      // Pause the job
-      HashMap map = new HashMap();
-      map.put(statusField,statusToString(newStatus));
-      performUpdate(map,"WHERE "+query,list,new StringSet(getJobStatusKey()));
-    }
-    catch (ManifoldCFException e)
-    {
-      signalRollback();
-      throw e;
-    }
-    catch (Error e)
-    {
-      signalRollback();
-      throw e;
-    }
-    finally
+    // Get the current job status
+    ArrayList list = new ArrayList();
+    String query = buildConjunctionClause(list,new ClauseDescription[]{
+      new UnitaryClause(idField,jobID)});
+    IResultSet set = performQuery("SELECT "+statusField+" FROM "+getTableName()+
+      " WHERE "+query+" FOR UPDATE",list,null,null);
+    if (set.getRowCount() == 0)
+      throw new ManifoldCFException("Job does not exist: "+jobID);
+    IResultRow row = set.getRow(0);
+    int status = stringToStatus(row.getValue(statusField).toString());
+    int newStatus;
+    switch (status)
     {
-      endTransaction();
+    case STATUS_ACTIVE:
+    case STATUS_ACTIVE_UNINSTALLED:
+    case STATUS_ACTIVE_NOOUTPUT:
+    case STATUS_ACTIVE_NEITHER:
+      newStatus = STATUS_PAUSING;
+      break;
+    case STATUS_ACTIVEWAITING:
+      newStatus = STATUS_PAUSINGWAITING;
+      break;
+    case STATUS_ACTIVEWAIT:
+      newStatus = STATUS_PAUSEDWAIT;
+      break;
+    case STATUS_ACTIVESEEDING:
+    case STATUS_ACTIVESEEDING_UNINSTALLED:
+    case STATUS_ACTIVESEEDING_NOOUTPUT:
+    case STATUS_ACTIVESEEDING_NEITHER:
+      newStatus = STATUS_PAUSINGSEEDING;
+      break;
+    case STATUS_ACTIVEWAITINGSEEDING:
+      newStatus = STATUS_PAUSINGWAITINGSEEDING;
+      break;
+    case STATUS_ACTIVEWAITSEEDING:
+      newStatus = STATUS_PAUSEDWAITSEEDING;
+      break;
+    default:
+      throw new ManifoldCFException("Job "+jobID+" is not active");
     }
+    // Pause the job
+    HashMap map = new HashMap();
+    map.put(statusField,statusToString(newStatus));
+    performUpdate(map,"WHERE "+query,list,new StringSet(getJobStatusKey()));
   }
 
   /** Restart a job.
@@ -1883,58 +1829,40 @@ public class Jobs extends org.apache.man
   public void restartJob(Long jobID)
     throws ManifoldCFException
   {
-    beginTransaction();
-    try
-    {
-      // Get the current job status
-      ArrayList list = new ArrayList();
-      String query = buildConjunctionClause(list,new ClauseDescription[]{
-        new UnitaryClause(idField,jobID)});
-      IResultSet set = performQuery("SELECT "+statusField+","+connectionNameField+","+outputNameField+"
FROM "+getTableName()+
-        " WHERE "+query+" FOR UPDATE",list,null,null);
-      if (set.getRowCount() == 0)
-        throw new ManifoldCFException("Job does not exist: "+jobID);
-      IResultRow row = set.getRow(0);
-      int status = stringToStatus(row.getValue(statusField).toString());
-      String connectionName = (String)row.getValue(connectionNameField);
-      String outputName = (String)row.getValue(outputNameField);
-      int newStatus;
-      switch (status)
-      {
-      case STATUS_PAUSED:
-        newStatus = STATUS_RESUMING;
-        break;
-      case STATUS_PAUSEDWAIT:
-        newStatus = STATUS_ACTIVEWAIT;
-        break;
-      case STATUS_PAUSEDSEEDING:
-        newStatus = STATUS_RESUMINGSEEDING;
-        break;
-      case STATUS_PAUSEDWAITSEEDING:
-        newStatus = STATUS_ACTIVEWAITSEEDING;
-        break;
-      default:
-        throw new ManifoldCFException("Job "+jobID+" is not paused");
-      }
-      // Pause the job
-      HashMap map = new HashMap();
-      map.put(statusField,statusToString(newStatus));
-      performUpdate(map,"WHERE "+query,list,new StringSet(getJobStatusKey()));
-    }
-    catch (ManifoldCFException e)
-    {
-      signalRollback();
-      throw e;
-    }
-    catch (Error e)
-    {
-      signalRollback();
-      throw e;
-    }
-    finally
+    // Get the current job status
+    ArrayList list = new ArrayList();
+    String query = buildConjunctionClause(list,new ClauseDescription[]{
+      new UnitaryClause(idField,jobID)});
+    IResultSet set = performQuery("SELECT "+statusField+","+connectionNameField+","+outputNameField+"
FROM "+getTableName()+
+      " WHERE "+query+" FOR UPDATE",list,null,null);
+    if (set.getRowCount() == 0)
+      throw new ManifoldCFException("Job does not exist: "+jobID);
+    IResultRow row = set.getRow(0);
+    int status = stringToStatus(row.getValue(statusField).toString());
+    String connectionName = (String)row.getValue(connectionNameField);
+    String outputName = (String)row.getValue(outputNameField);
+    int newStatus;
+    switch (status)
     {
-      endTransaction();
+    case STATUS_PAUSED:
+      newStatus = STATUS_RESUMING;
+      break;
+    case STATUS_PAUSEDWAIT:
+      newStatus = STATUS_ACTIVEWAIT;
+      break;
+    case STATUS_PAUSEDSEEDING:
+      newStatus = STATUS_RESUMINGSEEDING;
+      break;
+    case STATUS_PAUSEDWAITSEEDING:
+      newStatus = STATUS_ACTIVEWAITSEEDING;
+      break;
+    default:
+      throw new ManifoldCFException("Job "+jobID+" is not paused");
     }
+    // Pause the job
+    HashMap map = new HashMap();
+    map.put(statusField,statusToString(newStatus));
+    performUpdate(map,"WHERE "+query,list,new StringSet(getJobStatusKey()));
   }
 
   /** Update a job's status, and its reseed time.



Mime
View raw message