|
From: <ha...@us...> - 2006-12-30 17:33:35
|
Revision: 1500
http://svn.sourceforge.net/cogkit/?rev=1500&view=rev
Author: hategan
Date: 2006-12-30 09:33:34 -0800 (Sat, 30 Dec 2006)
Log Message:
-----------
updated toString()
Modified Paths:
--------------
trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/common/task/TaskImpl.java
Modified: trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/common/task/TaskImpl.java
===================================================================
--- trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/common/task/TaskImpl.java 2006-12-30 17:12:04 UTC (rev 1499)
+++ trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/common/task/TaskImpl.java 2006-12-30 17:33:34 UTC (rev 1500)
@@ -30,6 +30,8 @@
import org.globus.cog.util.CopyOnWriteHashSet;
public class TaskImpl implements Task {
+ public static final Status STATUS_NONE = new StatusImpl();
+
private Identity id = null;
private String name = null;
private int type = 0;
@@ -37,7 +39,7 @@
private Specification specification = null;
private String output = null;
private String error = null;
- private Status status = null;
+ private Status status = STATUS_NONE;
private CopyOnWriteHashSet statusListeners, outputListeners;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ha...@us...> - 2007-01-28 17:24:59
|
Revision: 1548
http://svn.sourceforge.net/cogkit/?rev=1548&view=rev
Author: hategan
Date: 2007-01-28 09:24:19 -0800 (Sun, 28 Jan 2007)
Log Message:
-----------
no unneccessary calls to notifyAll
Modified Paths:
--------------
trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/common/task/TaskImpl.java
Modified: trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/common/task/TaskImpl.java
===================================================================
--- trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/common/task/TaskImpl.java 2007-01-28 17:22:36 UTC (rev 1547)
+++ trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/common/task/TaskImpl.java 2007-01-28 17:24:19 UTC (rev 1548)
@@ -14,6 +14,7 @@
import java.util.Hashtable;
import java.util.Iterator;
+import org.apache.log4j.Logger;
import org.globus.cog.abstraction.impl.common.IdentityImpl;
import org.globus.cog.abstraction.impl.common.StatusEvent;
import org.globus.cog.abstraction.impl.common.StatusImpl;
@@ -30,6 +31,8 @@
import org.globus.cog.util.CopyOnWriteHashSet;
public class TaskImpl implements Task {
+ public static final Logger logger = Logger.getLogger(TaskImpl.class);
+
public static final Status STATUS_NONE = new StatusImpl();
private Identity id = null;
@@ -48,6 +51,8 @@
private Calendar completedTime = null;
private ArrayList serviceList = null;
private int requiredServices = 0;
+
+ private boolean anythingWaiting;
public TaskImpl() {
this.id = new IdentityImpl();
@@ -188,6 +193,9 @@
}
public void setStatus(Status status) {
+ if (logger.isDebugEnabled()) {
+ logger.debug(this + " setting status to " + status);
+ }
this.status = status;
if (this.status.getStatusCode() == Status.SUBMITTED) {
@@ -207,7 +215,9 @@
statusListeners.release();
}
synchronized (this) {
- notifyAll();
+ if (anythingWaiting) {
+ notifyAll();
+ }
}
}
@@ -300,6 +310,7 @@
}
public synchronized void waitFor() throws InterruptedException {
+ anythingWaiting = true;
while (!isFailed() && !isCompleted() && !isCanceled()) {
wait();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ha...@us...> - 2007-03-23 01:07:42
|
Revision: 1628
http://svn.sourceforge.net/cogkit/?rev=1628&view=rev
Author: hategan
Date: 2007-03-22 18:07:38 -0700 (Thu, 22 Mar 2007)
Log Message:
-----------
toString() returns task identity rather than specification
Modified Paths:
--------------
trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/common/task/TaskImpl.java
Modified: trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/common/task/TaskImpl.java
===================================================================
--- trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/common/task/TaskImpl.java 2007-03-12 02:13:48 UTC (rev 1627)
+++ trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/common/task/TaskImpl.java 2007-03-23 01:07:38 UTC (rev 1628)
@@ -32,9 +32,9 @@
public class TaskImpl implements Task {
public static final Logger logger = Logger.getLogger(TaskImpl.class);
-
- public static final Status STATUS_NONE = new StatusImpl();
-
+
+ public static final Status STATUS_NONE = new StatusImpl();
+
private Identity id = null;
private String name = null;
private int type = 0;
@@ -51,7 +51,7 @@
private Calendar completedTime = null;
private ArrayList serviceList = null;
private int requiredServices = 0;
-
+
private boolean anythingWaiting;
public TaskImpl() {
@@ -112,9 +112,11 @@
int sz = this.serviceList.size();
if (sz == index) {
this.serviceList.add(index, service);
- } else if (sz > index) {
+ }
+ else if (sz > index) {
this.serviceList.set(index, service);
- } else {
+ }
+ else {
throw new IllegalArgumentException("index(" + index + ") > size("
+ sz + ")");
}
@@ -129,9 +131,9 @@
}
public Service getService(int index) {
- if (index >= serviceList.size()) {
- return null;
- }
+ if (index >= serviceList.size()) {
+ return null;
+ }
return (Service) serviceList.get(index);
}
@@ -175,7 +177,8 @@
OutputListener listener = (OutputListener) i.next();
listener.outputChanged(event);
}
- } finally {
+ }
+ finally {
outputListeners.release();
}
}
@@ -194,13 +197,14 @@
public void setStatus(Status status) {
if (logger.isDebugEnabled()) {
- logger.debug(this + " setting status to " + status);
+ logger.debug(this + " setting status to " + status);
}
this.status = status;
if (this.status.getStatusCode() == Status.SUBMITTED) {
this.submittedTime = this.status.getTime();
- } else if (this.status.getStatusCode() == Status.COMPLETED) {
+ }
+ else if (this.status.getStatusCode() == Status.COMPLETED) {
this.completedTime = this.status.getTime();
}
@@ -211,13 +215,14 @@
StatusListener listener = (StatusListener) i.next();
listener.statusChanged(event);
}
- } finally {
+ }
+ finally {
statusListeners.release();
}
synchronized (this) {
- if (anythingWaiting) {
- notifyAll();
- }
+ if (anythingWaiting) {
+ notifyAll();
+ }
}
}
@@ -265,8 +270,7 @@
}
public String toString() {
- return "Task: \n\tSpecification: " + specification + "\n\tServices: "
- + serviceList + "\n\tStatus: " + status;
+ return "Task(type=" + type + ", identity=" + id + ")";
}
public boolean isUnsubmitted() {
@@ -310,7 +314,7 @@
}
public synchronized void waitFor() throws InterruptedException {
- anythingWaiting = true;
+ anythingWaiting = true;
while (!isFailed() && !isCompleted() && !isCanceled()) {
wait();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ha...@us...> - 2007-09-21 22:34:51
|
Revision: 1756
http://cogkit.svn.sourceforge.net/cogkit/?rev=1756&view=rev
Author: hategan
Date: 2007-09-21 15:34:48 -0700 (Fri, 21 Sep 2007)
Log Message:
-----------
log the type as a string
Modified Paths:
--------------
trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/common/task/TaskImpl.java
Modified: trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/common/task/TaskImpl.java
===================================================================
--- trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/common/task/TaskImpl.java 2007-09-21 15:40:05 UTC (rev 1755)
+++ trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/common/task/TaskImpl.java 2007-09-21 22:34:48 UTC (rev 1756)
@@ -270,8 +270,18 @@
}
public String toString() {
- return "Task(type=" + type + ", identity=" + id + ")";
+ return "Task(type=" + typeString(type) + ", identity=" + id + ")";
}
+
+ public static String typeString(int type) {
+ switch (type) {
+ case JOB_SUBMISSION: return "JOB_SUBMISSION";
+ case FILE_TRANSFER: return "FILE_TRANSFER";
+ case FILE_OPERATION: return "FILE_OPERATION";
+ case INFORMATION_QUERY: return "INFORMATION_QUERY";
+ default: return "UNKNOWN";
+ }
+ }
public boolean isUnsubmitted() {
return (this.status.getStatusCode() == Status.UNSUBMITTED);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ha...@us...> - 2008-03-26 14:37:25
|
Revision: 1944
http://cogkit.svn.sourceforge.net/cogkit/?rev=1944&view=rev
Author: hategan
Date: 2008-03-26 07:36:04 -0700 (Wed, 26 Mar 2008)
Log Message:
-----------
lazy attribute map initialization; clean-ups
Modified Paths:
--------------
trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/common/task/TaskImpl.java
Modified: trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/common/task/TaskImpl.java
===================================================================
--- trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/common/task/TaskImpl.java 2008-03-26 14:34:34 UTC (rev 1943)
+++ trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/common/task/TaskImpl.java 2008-03-26 14:36:04 UTC (rev 1944)
@@ -9,6 +9,7 @@
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -54,8 +55,7 @@
public TaskImpl() {
this.id = new IdentityImpl();
- this.attributes = new HashMap();
- this.serviceList = new ArrayList();
+ this.serviceList = new ArrayList(2);
this.status = new StatusImpl();
statusListeners = new CopyOnWriteHashSet();
outputListeners = new CopyOnWriteHashSet();
@@ -106,8 +106,10 @@
}
public void setService(int index, Service service) {
- this.serviceList.ensureCapacity(index + 1);
- int sz = this.serviceList.size();
+ while (serviceList.size() < index) {
+ serviceList.add(null);
+ }
+ int sz = serviceList.size();
if (sz == index) {
this.serviceList.add(index, service);
}
@@ -121,11 +123,11 @@
}
public void addService(Service service) {
- this.serviceList.add(service);
+ serviceList.add(service);
}
public Service removeService(int index) {
- return (Service) this.serviceList.remove(index);
+ return (Service) serviceList.remove(index);
}
public Service getService(int index) {
@@ -137,7 +139,7 @@
public Collection removeAllServices() {
Collection services = this.serviceList;
- this.serviceList = new ArrayList();
+ this.serviceList = new ArrayList(2);
return services;
}
@@ -146,12 +148,11 @@
}
public Collection getAllServices() {
- return this.serviceList;
+ return serviceList;
}
public void setRequiredService(int value) {
this.requiredServices = value;
- this.serviceList.ensureCapacity(value);
}
public int getRequiredServices() {
@@ -222,7 +223,7 @@
notifyListeners(status);
}
// Now prove that this works correctly with concurrent updates.
- // I will pay $20 for the first one.
+ // I will pay $20 for the first such proof that I receive.
}
protected void notifyListeners(Status status) {
@@ -256,15 +257,28 @@
}
public void setAttribute(String name, Object value) {
- this.attributes.put(name.toLowerCase(), value);
+ if (attributes == null) {
+ attributes = new HashMap();
+ }
+ attributes.put(name.toLowerCase(), value);
}
public Object getAttribute(String name) {
- return this.attributes.get(name.toLowerCase());
+ if (attributes != null) {
+ return attributes.get(name.toLowerCase());
+ }
+ else {
+ return null;
+ }
}
public Collection getAttributeNames() {
- return this.attributes.keySet();
+ if (attributes != null) {
+ return attributes.keySet();
+ }
+ else {
+ return Collections.EMPTY_MAP.keySet();
+ }
}
public void addStatusListener(StatusListener listener) {
@@ -335,7 +349,7 @@
}
public int hashCode() {
- return (int) this.id.getValue();
+ return this.id.hashCode();
}
public synchronized void waitFor() throws InterruptedException {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|