From da731d2bb81666b9c697d9099da632e7dfcdc0f7 Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Tue, 9 Sep 2014 12:13:21 +0200 Subject: Replaced int sysKey Item identifier with UUID, which is now portable. ItemPath objects are now used to identify Items throughout the kernel, replacing ints and Integers. --- .../java/com/c2kernel/entity/agent/JobList.java | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'src/main/java/com/c2kernel/entity/agent/JobList.java') diff --git a/src/main/java/com/c2kernel/entity/agent/JobList.java b/src/main/java/com/c2kernel/entity/agent/JobList.java index 271decb..ac3b421 100644 --- a/src/main/java/com/c2kernel/entity/agent/JobList.java +++ b/src/main/java/com/c2kernel/entity/agent/JobList.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.Vector; +import com.c2kernel.lookup.ItemPath; import com.c2kernel.persistency.ClusterStorage; import com.c2kernel.persistency.RemoteMap; import com.c2kernel.utils.Logger; @@ -20,9 +21,9 @@ public class JobList extends RemoteMap /************************************************************************** * Empty constructor for Castor **************************************************************************/ - public JobList(int sysKey, Object locker) + public JobList(ItemPath itemPath, Object locker) { - super(sysKey, ClusterStorage.JOB, locker); + super(itemPath, ClusterStorage.JOB, locker); } @@ -55,7 +56,7 @@ public class JobList extends RemoteMap /** * @param job */ - public void removeJobsWithSysKey( int sysKey ) + public void removeJobsForItem( ItemPath itemPath ) { Iterator currentMembers = values().iterator(); Job j = null; @@ -64,14 +65,14 @@ public class JobList extends RemoteMap { j = currentMembers.next(); - if( j.getItemSysKey() == sysKey ) + if( j.getItemPath().equals(itemPath) ) remove( String.valueOf(j.getId()) ); } - Logger.msg(5, "JobList::removeJobsWithSysKey() - " + sysKey + " DONE." ); + Logger.msg(5, "JobList::removeJobsWithSysKey() - " + itemPath + " DONE." ); } - public void removeJobsForStep( int sysKey, String stepPath ) + public void removeJobsForStep( ItemPath itemPath, String stepPath ) { ArrayList staleJobs = new ArrayList(); Iterator jobIter = keySet().iterator(); @@ -79,7 +80,7 @@ public class JobList extends RemoteMap { String jid = jobIter.next(); Job j = get(jid); - if( j.getItemSysKey() == sysKey && j.getStepPath().equals(stepPath)) + if( j.getItemPath().equals(itemPath) && j.getStepPath().equals(stepPath)) staleJobs.add(jid); } @@ -88,14 +89,14 @@ public class JobList extends RemoteMap for (String jid : staleJobs) { remove(jid); } - Logger.msg(5, "JobList::removeJobsForStep() - " + sysKey + " DONE." ); + Logger.msg(5, "JobList::removeJobsForStep() - " + itemPath + " DONE." ); } /** * @param itemKey * @param string * @return */ - public Vector getJobsOfSysKey(int sysKey) + public Vector getJobsOfItem( ItemPath itemPath ) { Iterator currentMembers = values().iterator(); Job j = null; @@ -105,7 +106,7 @@ public class JobList extends RemoteMap { j = currentMembers.next(); - if( j.getItemSysKey() == sysKey ) + if( j.getItemPath().equals(itemPath) ) jobs.add(j); } -- cgit v1.2.3