diff --git a/cnr@grid5.4dsoft.hu b/cnr@grid5.4dsoft.hu deleted file mode 100644 index 0f59328..0000000 Binary files a/cnr@grid5.4dsoft.hu and /dev/null differ diff --git a/etc/deploy-jndi-config.xml b/etc/deploy-jndi-config.xml index f992ace..eb2be06 100644 --- a/etc/deploy-jndi-config.xml +++ b/etc/deploy-jndi-config.xml @@ -4,16 +4,24 @@ + name="configDir" + value="@config.dir@" + type="java.lang.String" + override="false" /> + + + + + diff --git a/gcube1@pc-simi b/gcube1@pc-simi deleted file mode 100644 index b3daf36..0000000 Binary files a/gcube1@pc-simi and /dev/null differ diff --git a/src/org/gcube/informationsystem/registry/impl/RegistryFactory.java b/src/org/gcube/informationsystem/registry/impl/RegistryFactory.java index 692bf80..d46c56a 100644 --- a/src/org/gcube/informationsystem/registry/impl/RegistryFactory.java +++ b/src/org/gcube/informationsystem/registry/impl/RegistryFactory.java @@ -55,24 +55,21 @@ import static org.gcube.informationsystem.registry.impl.core.RegistryConfigurati */ public class RegistryFactory extends GCUBEPortType { - private final long delayRemoveTyme= 120000; - + /**Name of temporaryResourceLifetimeInMs JNDI environment.*/ + private static final String LIFETIME_JNDI_NAME = "temporaryResourceLifetimeInMs"; /** - * The UUIDGen + * Lifetime of temporary resources */ + private static long temporaryResourceLifetimeInMs= 120000; + + + /**The UUIDGen */ private static final UUIDGen uuidgen = UUIDGenFactory.getUUIDGen(); - - /** - * Object logger. - * */ + /**Object logger*/ protected final GCUBELog logger = new GCUBELog(RegistryFactory.class); - - /** - * - * - */ + enum OperationType {create,update,destroy}; /** @@ -83,7 +80,15 @@ public class RegistryFactory extends GCUBEPortType { /** the key used to label the Factory Resource */ public static final String NOTIFICATOR_RESOURCE_KEY = "RegistryResource"; - + /** + * {@inheritDoc} + */ + @Override + protected void onInitialisation() throws Exception { + temporaryResourceLifetimeInMs = (Long)ServiceContext.getContext().getProperty(LIFETIME_JNDI_NAME); + logger.info("Temporary resources lifetime = " + temporaryResourceLifetimeInMs); + } + /** * Use to Load from Disk persistence profiles and registers it into the IS-IC ( in case the IS-IC is empty) * @@ -179,7 +184,7 @@ public class RegistryFactory extends GCUBEPortType { long timestamp; if (resource.getType().compareTo(GCUBEHostingNode.TYPE)!=0){ GCUBEScope tmpScope= ServiceContext.getContext().getScope().getType() == GCUBEScope.Type.VRE ? ServiceContext.getContext().getScope().getEnclosingScope() : ServiceContext.getContext().getScope(); - timestamp=System.currentTimeMillis()+delayRemoveTyme; + timestamp=System.currentTimeMillis()+temporaryResourceLifetimeInMs; Couple c= new Couple(timestamp, presource); if(!ServiceContext.threadTable.get(tmpScope.getName()).getStack().contains(c)){ @@ -187,7 +192,7 @@ public class RegistryFactory extends GCUBEPortType { logger.trace("Adding resource to EliminatePoolingThread "+presource.getGCubeResource().getID()); }else{ int index= ServiceContext.threadTable.get(tmpScope.getName()).getStack().indexOf(c); - ServiceContext.threadTable.get(tmpScope.getName()).getStack().get(index).timestamp=timestamp+delayRemoveTyme; + ServiceContext.threadTable.get(tmpScope.getName()).getStack().get(index).timestamp=timestamp+temporaryResourceLifetimeInMs; } } } @@ -265,14 +270,14 @@ public class RegistryFactory extends GCUBEPortType { long timestamp; if (resource.getType().compareTo(GCUBEHostingNode.TYPE)!=0){ GCUBEScope tmpScope= ServiceContext.getContext().getScope().getType() == GCUBEScope.Type.VRE ? ServiceContext.getContext().getScope().getEnclosingScope() : ServiceContext.getContext().getScope(); - timestamp=System.currentTimeMillis()+delayRemoveTyme; + timestamp=System.currentTimeMillis()+temporaryResourceLifetimeInMs; Couple c= new Couple(timestamp, pr); if(!ServiceContext.threadTable.get(tmpScope.getName()).getStack().contains(c)){ ServiceContext.threadTable.get(tmpScope.getName()).getStack().add(c); logger.trace("Adding resource to EliminatePoolingThread "+pr.getGCubeResource().getID()); }else{ int index= ServiceContext.threadTable.get(tmpScope.getName()).getStack().indexOf(c); - ServiceContext.threadTable.get(tmpScope.getName()).getStack().get(index).timestamp=timestamp+delayRemoveTyme; + ServiceContext.threadTable.get(tmpScope.getName()).getStack().get(index).timestamp=timestamp+temporaryResourceLifetimeInMs; } } }