Fixings on resources' sweeper thread
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/information-system/gCubeIS/Collector@30237 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
f78e567fa1
commit
f182095fef
|
@ -161,12 +161,6 @@ public class AggregatorRegisteredResource extends AggregatorServiceGroupResource
|
||||||
|
|
||||||
logger.info("New delivered resource");
|
logger.info("New delivered resource");
|
||||||
try {
|
try {
|
||||||
|
|
||||||
/*
|
|
||||||
* logger.debug(State.logPrefix + "delivered message -> " +
|
|
||||||
* AnyHelper.toSingleString(messageObj));
|
|
||||||
*/
|
|
||||||
|
|
||||||
// get the message content
|
// get the message content
|
||||||
MsgParser aentry = new MsgParser(messageObj);
|
MsgParser aentry = new MsgParser(messageObj);
|
||||||
String entryType = aentry.getEntryType();
|
String entryType = aentry.getEntryType();
|
||||||
|
@ -174,13 +168,7 @@ public class AggregatorRegisteredResource extends AggregatorServiceGroupResource
|
||||||
logger.debug("Entry RunningInstance ID " + aentry.getRunningInstanceID());
|
logger.debug("Entry RunningInstance ID " + aentry.getRunningInstanceID());
|
||||||
logger.debug("Entry Service Name " + aentry.getServiceName());
|
logger.debug("Entry Service Name " + aentry.getServiceName());
|
||||||
logger.debug("Entry Service Class " + aentry.getServiceClass());
|
logger.debug("Entry Service Class " + aentry.getServiceClass());
|
||||||
|
|
||||||
|
|
||||||
// logger.debug(State.logPrefix + "getEntryAsString " +
|
|
||||||
// aentry.getEntryAsString());
|
|
||||||
|
|
||||||
// MessageElement[] message = messageObj.get_any();
|
|
||||||
|
|
||||||
// extract the entry EPR
|
// extract the entry EPR
|
||||||
EntryParser entryparser = new EntryParser(entry);
|
EntryParser entryparser = new EntryParser(entry);
|
||||||
EntryEPRParser sinkparser = entryparser.getEPRSinkParser();
|
EntryEPRParser sinkparser = entryparser.getEPRSinkParser();
|
||||||
|
@ -190,6 +178,9 @@ public class AggregatorRegisteredResource extends AggregatorServiceGroupResource
|
||||||
|
|
||||||
// Build the new resource to store
|
// Build the new resource to store
|
||||||
logger.debug("Storing the new delivered resource");
|
logger.debug("Storing the new delivered resource");
|
||||||
|
|
||||||
|
//TODO: check if it's a profile or an RP, by relying on the publisher (registry or not)
|
||||||
|
|
||||||
GCUBEInstanceStateResource instanceState = new GCUBEInstanceStateResource();
|
GCUBEInstanceStateResource instanceState = new GCUBEInstanceStateResource();
|
||||||
instanceState.setResourceName(Identifier.buildInstanceStateID(entryparser));
|
instanceState.setResourceName(Identifier.buildInstanceStateID(entryparser));
|
||||||
instanceState.setContent(aentry.getEntryAsString());
|
instanceState.setContent(aentry.getEntryAsString());
|
||||||
|
|
|
@ -70,6 +70,7 @@ public class State {
|
||||||
Sweeper sweeper = new Sweeper(Long.valueOf((String) ICServiceContext.getContext().getProperty("sweeperIntervalInMillis", true)),
|
Sweeper sweeper = new Sweeper(Long.valueOf((String) ICServiceContext.getContext().getProperty("sweeperIntervalInMillis", true)),
|
||||||
Long.valueOf((String) ICServiceContext.getContext().getProperty("resourceExpirationTimeInMillis", true)));
|
Long.valueOf((String) ICServiceContext.getContext().getProperty("resourceExpirationTimeInMillis", true)));
|
||||||
State.sweeperT = new Thread(sweeper);
|
State.sweeperT = new Thread(sweeper);
|
||||||
|
State.sweeperT.setName("ICSweeper");
|
||||||
State.sweeperT.start();
|
State.sweeperT.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,6 +81,7 @@ public class State {
|
||||||
if (scheduler != null) {
|
if (scheduler != null) {
|
||||||
if (State.schedulerT == null)
|
if (State.schedulerT == null)
|
||||||
State.schedulerT = new Thread(scheduler);
|
State.schedulerT = new Thread(scheduler);
|
||||||
|
State.schedulerT.setName("BackupScheduler");
|
||||||
State.schedulerT.start();
|
State.schedulerT.start();
|
||||||
}
|
}
|
||||||
logger.info("IC service initialization completed");
|
logger.info("IC service initialization completed");
|
||||||
|
|
|
@ -83,10 +83,15 @@ public class Sweeper implements Runnable {
|
||||||
GCUBEInstanceStateResource tempresource = new GCUBEInstanceStateResource();
|
GCUBEInstanceStateResource tempresource = new GCUBEInstanceStateResource();
|
||||||
tempresource.setResourceName(id);
|
tempresource.setResourceName(id);
|
||||||
GCUBEXMLResource xmlresource = new GCUBEXMLResource(tempresource);
|
GCUBEXMLResource xmlresource = new GCUBEXMLResource(tempresource);
|
||||||
State.getDataManager().retrieveResourceContent(new GCUBEXMLResource(tempresource));
|
State.getDataManager().retrieveResourceContent(xmlresource);
|
||||||
if (now.getTimeInMillis() - xmlresource.getLastUpdateTimeinMills() > Sweeper.resourceExpirationTime)
|
logger.trace("Checking resource " + id);
|
||||||
|
logger.trace("Now is " + now.getTimeInMillis());
|
||||||
|
logger.trace("Resource expires at " + xmlresource.getTerminationTime().getTimeInMillis());
|
||||||
|
if (now.getTimeInMillis() > xmlresource.getTerminationTime().getTimeInMillis()) {
|
||||||
// removes the resources from the database
|
// removes the resources from the database
|
||||||
State.getDataManager().deleteResource(xmlresource);
|
State.getDataManager().deleteResource(xmlresource);
|
||||||
|
logger.info("Resource " + xmlresource.getResourceName() + " deleted");
|
||||||
|
}
|
||||||
// break;
|
// break;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.debug("IC sweeper - the resource " + id + " is no longer available in the storage");
|
logger.debug("IC sweeper - the resource " + id + " is no longer available in the storage");
|
||||||
|
|
|
@ -17,7 +17,6 @@ import org.gcube.informationsystem.collector.stubs.wsdai.InvalidResourceNameFaul
|
||||||
import org.gcube.informationsystem.collector.stubs.wsdai.NotAuthorizedFaultType;
|
import org.gcube.informationsystem.collector.stubs.wsdai.NotAuthorizedFaultType;
|
||||||
import org.gcube.informationsystem.collector.stubs.wsdai.ServiceBusyFaultType;
|
import org.gcube.informationsystem.collector.stubs.wsdai.ServiceBusyFaultType;
|
||||||
import org.gcube.informationsystem.collector.stubs.wsdaix.AddDocumentRequestWrapper;
|
import org.gcube.informationsystem.collector.stubs.wsdaix.AddDocumentRequestWrapper;
|
||||||
import org.gcube.informationsystem.collector.stubs.wsdaix.AddDocumentResponseWrapperResponse;
|
|
||||||
import org.gcube.informationsystem.collector.stubs.wsdaix.AddDocumentsRequest;
|
import org.gcube.informationsystem.collector.stubs.wsdaix.AddDocumentsRequest;
|
||||||
import org.gcube.informationsystem.collector.stubs.wsdaix.AddDocumentsResponse;
|
import org.gcube.informationsystem.collector.stubs.wsdaix.AddDocumentsResponse;
|
||||||
import org.gcube.informationsystem.collector.stubs.wsdaix.InvalidCollectionNameFaultType;
|
import org.gcube.informationsystem.collector.stubs.wsdaix.InvalidCollectionNameFaultType;
|
||||||
|
|
|
@ -22,7 +22,6 @@ import org.gcube.informationsystem.collector.stubs.wsdai.NotAuthorizedFaultType;
|
||||||
import org.gcube.informationsystem.collector.stubs.wsdai.ServiceBusyFaultType;
|
import org.gcube.informationsystem.collector.stubs.wsdai.ServiceBusyFaultType;
|
||||||
import org.gcube.informationsystem.collector.stubs.wsdaix.GetDocumentRequestWrapper;
|
import org.gcube.informationsystem.collector.stubs.wsdaix.GetDocumentRequestWrapper;
|
||||||
import org.gcube.informationsystem.collector.stubs.wsdaix.GetDocumentResponseWrapper;
|
import org.gcube.informationsystem.collector.stubs.wsdaix.GetDocumentResponseWrapper;
|
||||||
import org.gcube.informationsystem.collector.stubs.wsdaix.GetDocumentResponseWrapperResponse;
|
|
||||||
import org.gcube.informationsystem.collector.stubs.wsdaix.GetDocumentsRequest;
|
import org.gcube.informationsystem.collector.stubs.wsdaix.GetDocumentsRequest;
|
||||||
import org.gcube.informationsystem.collector.stubs.wsdaix.GetDocumentsResponse;
|
import org.gcube.informationsystem.collector.stubs.wsdaix.GetDocumentsResponse;
|
||||||
import org.gcube.informationsystem.collector.stubs.wsdaix.InvalidCollectionNameFaultType;
|
import org.gcube.informationsystem.collector.stubs.wsdaix.InvalidCollectionNameFaultType;
|
||||||
|
|
Loading…
Reference in New Issue