Temporary resources lifetime as parameter in the JNDI config
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/information-system/gCubeIS/Registry@12013 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
fffd2fd2b3
commit
ff45baf3b1
Binary file not shown.
|
@ -4,16 +4,24 @@
|
|||
<service name="gcube/informationsystem/registry">
|
||||
|
||||
<environment
|
||||
name="configDir"
|
||||
value="@config.dir@"
|
||||
type="java.lang.String"
|
||||
override="false" />
|
||||
name="configDir"
|
||||
value="@config.dir@"
|
||||
type="java.lang.String"
|
||||
override="false" />
|
||||
|
||||
<environment
|
||||
name="securityManagerClass"
|
||||
value="org.gcube.common.core.security.GCUBESimpleServiceSecurityManager"
|
||||
type="java.lang.String"
|
||||
override="false" />
|
||||
|
||||
<!-- Lifetime for temporary resources, after this period temporary resources are destroyed-->
|
||||
<environment
|
||||
name="temporaryResourceLifetimeInMs"
|
||||
value="240000"
|
||||
type="java.lang.Long"
|
||||
override="false" />
|
||||
|
||||
<!--
|
||||
<environment
|
||||
name="startScopes"
|
||||
|
@ -38,11 +46,6 @@
|
|||
type="java.lang.String"
|
||||
override="false"/>
|
||||
|
||||
<!--<environment
|
||||
name="lifeTime"
|
||||
value="120"
|
||||
type="java.lang.Integer"
|
||||
override="false" /> -->
|
||||
|
||||
<resource name="publicationProfile" type="org.gcube.common.core.state.GCUBEPublicationProfile">
|
||||
<resourceParams>
|
||||
|
|
BIN
gcube1@pc-simi
BIN
gcube1@pc-simi
Binary file not shown.
|
@ -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,6 +80,14 @@ 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue