|
From: <ha...@us...> - 2007-05-20 11:05:43
|
Revision: 1650
http://svn.sourceforge.net/cogkit/?rev=1650&view=rev
Author: hategan
Date: 2007-05-20 04:05:38 -0700 (Sun, 20 May 2007)
Log Message:
-----------
better cleanup
Modified Paths:
--------------
trunk/current/src/cog/modules/provider-gt4_0_0/CHANGES.txt
trunk/current/src/cog/modules/provider-gt4_0_0/src/org/globus/cog/abstraction/impl/execution/gt4_0_0/JobSubmissionTaskHandler.java
Modified: trunk/current/src/cog/modules/provider-gt4_0_0/CHANGES.txt
===================================================================
--- trunk/current/src/cog/modules/provider-gt4_0_0/CHANGES.txt 2007-05-18 13:18:08 UTC (rev 1649)
+++ trunk/current/src/cog/modules/provider-gt4_0_0/CHANGES.txt 2007-05-20 11:05:38 UTC (rev 1650)
@@ -1,3 +1,7 @@
+(05/20/2007)
+
+*** Corrected instances in which cleanup is done
+
(05/18/2007)
*** Failure to destroy a resource causes a warning only if the
Modified: trunk/current/src/cog/modules/provider-gt4_0_0/src/org/globus/cog/abstraction/impl/execution/gt4_0_0/JobSubmissionTaskHandler.java
===================================================================
--- trunk/current/src/cog/modules/provider-gt4_0_0/src/org/globus/cog/abstraction/impl/execution/gt4_0_0/JobSubmissionTaskHandler.java 2007-05-18 13:18:08 UTC (rev 1649)
+++ trunk/current/src/cog/modules/provider-gt4_0_0/src/org/globus/cog/abstraction/impl/execution/gt4_0_0/JobSubmissionTaskHandler.java 2007-05-20 11:05:38 UTC (rev 1650)
@@ -189,13 +189,9 @@
}
catch (Exception e) {
failTask(e.getMessage(), e);
- try {
- cleanup();
- }
- catch (Exception ex) {
- logger.info("Unable to destroy remote service for task "
- + this.task.getIdentity().toString(), ex);
- }
+ //No need for cleanup. Reportedly no resource has been created
+ //if an exception is thrown
+ gramJob.removeListener(this);
throw new TaskSubmissionException("Cannot submit job: "
+ e.getMessage(), e);
}
@@ -319,6 +315,7 @@
}
public void stateChanged(GramJob job) {
+ boolean cleanup = false;
StateEnumeration state = job.getState();
if (state.equals(StateEnumeration.Active)) {
this.task.setStatus(Status.ACTIVE);
@@ -332,6 +329,7 @@
}
if (canceled) {
this.task.setStatus(Status.CANCELED);
+ this.gramJob.removeListener(this);
}
else {
int errorCode = job.getError();
@@ -343,8 +341,8 @@
else {
failTask("#" + errorCode, null);
}
+ cleanup = true;
}
- gramJob.removeListener(this);
}
else if (state.equals(StateEnumeration.Done)) {
if (job.getExitCode() != 0) {
@@ -355,13 +353,7 @@
else {
this.task.setStatus(Status.COMPLETED);
}
- try {
- cleanup();
- }
- catch (Exception e) {
- logger.warn("Unable to destroy remote service for task "
- + this.task.getIdentity().toString(), e);
- }
+ cleanup = true;
}
else if (state.equals(StateEnumeration.Suspended)) {
this.task.setStatus(Status.SUSPENDED);
@@ -372,6 +364,15 @@
else {
logger.debug("Unknown status: " + state.getValue());
}
+ if (cleanup) {
+ try {
+ cleanup();
+ }
+ catch (Exception e) {
+ logger.warn("Unable to destroy remote service for task "
+ + this.task.getIdentity().toString(), e);
+ }
+ }
}
private void failTask(String message, Exception exception) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|