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:
Manuele Simi 2010-10-28 18:29:54 +00:00
parent f78e567fa1
commit f182095fef
5 changed files with 13 additions and 17 deletions

View File

@ -161,12 +161,6 @@ public class AggregatorRegisteredResource extends AggregatorServiceGroupResource
logger.info("New delivered resource");
try {
/*
* logger.debug(State.logPrefix + "delivered message -> " +
* AnyHelper.toSingleString(messageObj));
*/
// get the message content
MsgParser aentry = new MsgParser(messageObj);
String entryType = aentry.getEntryType();
@ -174,13 +168,7 @@ public class AggregatorRegisteredResource extends AggregatorServiceGroupResource
logger.debug("Entry RunningInstance ID " + aentry.getRunningInstanceID());
logger.debug("Entry Service Name " + aentry.getServiceName());
logger.debug("Entry Service Class " + aentry.getServiceClass());
// logger.debug(State.logPrefix + "getEntryAsString " +
// aentry.getEntryAsString());
// MessageElement[] message = messageObj.get_any();
// extract the entry EPR
EntryParser entryparser = new EntryParser(entry);
EntryEPRParser sinkparser = entryparser.getEPRSinkParser();
@ -190,6 +178,9 @@ public class AggregatorRegisteredResource extends AggregatorServiceGroupResource
// Build the new resource to store
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();
instanceState.setResourceName(Identifier.buildInstanceStateID(entryparser));
instanceState.setContent(aentry.getEntryAsString());

View File

@ -70,6 +70,7 @@ public class State {
Sweeper sweeper = new Sweeper(Long.valueOf((String) ICServiceContext.getContext().getProperty("sweeperIntervalInMillis", true)),
Long.valueOf((String) ICServiceContext.getContext().getProperty("resourceExpirationTimeInMillis", true)));
State.sweeperT = new Thread(sweeper);
State.sweeperT.setName("ICSweeper");
State.sweeperT.start();
}
@ -80,6 +81,7 @@ public class State {
if (scheduler != null) {
if (State.schedulerT == null)
State.schedulerT = new Thread(scheduler);
State.schedulerT.setName("BackupScheduler");
State.schedulerT.start();
}
logger.info("IC service initialization completed");

View File

@ -83,10 +83,15 @@ public class Sweeper implements Runnable {
GCUBEInstanceStateResource tempresource = new GCUBEInstanceStateResource();
tempresource.setResourceName(id);
GCUBEXMLResource xmlresource = new GCUBEXMLResource(tempresource);
State.getDataManager().retrieveResourceContent(new GCUBEXMLResource(tempresource));
if (now.getTimeInMillis() - xmlresource.getLastUpdateTimeinMills() > Sweeper.resourceExpirationTime)
State.getDataManager().retrieveResourceContent(xmlresource);
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
State.getDataManager().deleteResource(xmlresource);
logger.info("Resource " + xmlresource.getResourceName() + " deleted");
}
// break;
} catch (Exception e) {
logger.debug("IC sweeper - the resource " + id + " is no longer available in the storage");

View File

@ -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.ServiceBusyFaultType;
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.AddDocumentsResponse;
import org.gcube.informationsystem.collector.stubs.wsdaix.InvalidCollectionNameFaultType;

View File

@ -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.wsdaix.GetDocumentRequestWrapper;
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.GetDocumentsResponse;
import org.gcube.informationsystem.collector.stubs.wsdaix.InvalidCollectionNameFaultType;