git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/information-system/gCubeIS/Registry@501 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
12d1508621
commit
c7333927a7
|
@ -52,7 +52,9 @@ import org.oasis.wsrf.lifetime.Destroy;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Andrea Manzi (ISTI-CNR)
|
* Registry Factory implementation
|
||||||
|
*
|
||||||
|
* @author Andrea Manzi, Manuele SImi (ISTI-CNR)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class RegistryFactory extends GCUBEStartupPortType{
|
public class RegistryFactory extends GCUBEStartupPortType{
|
||||||
|
@ -197,7 +199,7 @@ public class RegistryFactory extends GCUBEStartupPortType{
|
||||||
try {
|
try {
|
||||||
updateCounterInfo (resource.getID(),inputMessage.getType(), OperationType.create.name(),Calendar.getInstance());
|
updateCounterInfo (resource.getID(),inputMessage.getType(), OperationType.create.name(),Calendar.getInstance());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("Error updating Counting info for resource with ID " + resource.getID());
|
logger.warn("Error updating Counting info for resource with ID " + resource.getID());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,8 +261,7 @@ public class RegistryFactory extends GCUBEStartupPortType{
|
||||||
try {
|
try {
|
||||||
updateCounterInfo (ID,mess.getType(), OperationType.update.name(),Calendar.getInstance());
|
updateCounterInfo (ID,mess.getType(), OperationType.update.name(),Calendar.getInstance());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("Error updating Counting info for resource with ID " + resource.getID());
|
logger.warn("Error updating counting info for resource with ID " + resource.getID());
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
logger.info("Profile " + mess.getUniqueID() + " updated");
|
logger.info("Profile " + mess.getUniqueID() + " updated");
|
||||||
return new UpdateResourceResponse();
|
return new UpdateResourceResponse();
|
||||||
|
@ -333,8 +334,8 @@ public class RegistryFactory extends GCUBEStartupPortType{
|
||||||
updateCounterInfo(ID,type,OperationType.destroy.name(),Calendar.getInstance());
|
updateCounterInfo(ID,type,OperationType.destroy.name(),Calendar.getInstance());
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
logger.error("Error updating Counting info for resource with ID " + ID);
|
logger.warn("Error updating counting info for resource with ID " + ID);
|
||||||
e.printStackTrace();
|
//e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
return new RemoveResourceResponse();
|
return new RemoveResourceResponse();
|
||||||
|
|
|
@ -46,13 +46,14 @@ public class ServiceContext extends GCUBEServiceContext {
|
||||||
|
|
||||||
protected boolean repeat(Exception exception, int exceptionCount) {
|
protected boolean repeat(Exception exception, int exceptionCount) {
|
||||||
if (exception!=null) {
|
if (exception!=null) {
|
||||||
logger.warn("Failed to create the notification resource (attempt "+exceptionCount+" out of 20)",exception);
|
/*logger.warn("Failed to create the notification resource (attempt "+exceptionCount+" out of 20)",exception);
|
||||||
if (exceptionCount >= 20) {
|
if (exceptionCount >= 20) {
|
||||||
logger.error("Max attempts reached, no more chance to register the notification resource");
|
logger.error("Max attempts reached, no more chance to register the notification resource");
|
||||||
return false;
|
return false;
|
||||||
}
|
} else*/
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
|
} else
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -61,15 +62,10 @@ public class ServiceContext extends GCUBEServiceContext {
|
||||||
protected class NotificationResource extends GCUBEHandler<Object> {
|
protected class NotificationResource extends GCUBEHandler<Object> {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void run() throws Exception {
|
public void run() throws Exception {
|
||||||
try {
|
|
||||||
ServiceContext.getContext().setScope(ServiceContext.getContext().getInstance().getScopes().values().toArray(new GCUBEScope[0])[0]);
|
ServiceContext.getContext().setScope(ServiceContext.getContext().getInstance().getScopes().values().toArray(new GCUBEScope[0])[0]);
|
||||||
RegistryFactoryResource resource = (RegistryFactoryResource) FactoryContext.getContext().getWSHome().create(
|
RegistryFactoryResource resource = (RegistryFactoryResource) FactoryContext.getContext().getWSHome().create(
|
||||||
FactoryContext.getContext().makeKey(RegistryFactory.NOTIFICATOR_RESOURCE_KEY));
|
FactoryContext.getContext().makeKey(RegistryFactory.NOTIFICATOR_RESOURCE_KEY));
|
||||||
resource.getPersistenceDelegate().store(resource );
|
resource.getPersistenceDelegate().store(resource );
|
||||||
} catch (Exception e) {
|
|
||||||
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +87,7 @@ public class ServiceContext extends GCUBEServiceContext {
|
||||||
|
|
||||||
//creates the single RegistryResource used to raise notifications about profiles' changes
|
//creates the single RegistryResource used to raise notifications about profiles' changes
|
||||||
logger.info("Creating IS-Registry notification resource...");
|
logger.info("Creating IS-Registry notification resource...");
|
||||||
/*new Thread() {
|
new Thread() {
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
Thread.sleep(5000);
|
Thread.sleep(5000);
|
||||||
|
@ -102,11 +98,11 @@ public class ServiceContext extends GCUBEServiceContext {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
ServiceContext.this.logger.error("Failed to create the notification resource", e);
|
ServiceContext.this.logger.error("Failed to create the notification resource", e);
|
||||||
}
|
}
|
||||||
}}.start();*/
|
}}.start();
|
||||||
|
|
||||||
NotificationResourceScheduler scheduler = new NotificationResourceScheduler(3000, GCUBEScheduledHandler.Mode.LAZY);
|
/*NotificationResourceScheduler scheduler = new NotificationResourceScheduler(10, GCUBEScheduledHandler.Mode.LAZY);
|
||||||
scheduler.setHandled(new NotificationResource());
|
scheduler.setHandled(new NotificationResource());
|
||||||
scheduler.run();
|
scheduler.run();*/
|
||||||
|
|
||||||
logger.info("IS-Registry notification resource registered");
|
logger.info("IS-Registry notification resource registered");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue