This commit is contained in:
Manuele Simi 2008-04-24 00:12:47 +00:00
parent 12d1508621
commit c7333927a7
2 changed files with 18 additions and 21 deletions

View File

@ -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{
@ -197,7 +199,7 @@ public class RegistryFactory extends GCUBEStartupPortType{
try {
updateCounterInfo (resource.getID(),inputMessage.getType(), OperationType.create.name(),Calendar.getInstance());
} 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 {
updateCounterInfo (ID,mess.getType(), OperationType.update.name(),Calendar.getInstance());
} catch (Exception e) {
logger.error("Error updating Counting info for resource with ID " + resource.getID());
e.printStackTrace();
logger.warn("Error updating counting info for resource with ID " + resource.getID());
}
logger.info("Profile " + mess.getUniqueID() + " updated");
return new UpdateResourceResponse();
@ -333,8 +334,8 @@ public class RegistryFactory extends GCUBEStartupPortType{
updateCounterInfo(ID,type,OperationType.destroy.name(),Calendar.getInstance());
}
catch (Exception e) {
logger.error("Error updating Counting info for resource with ID " + ID);
e.printStackTrace();
logger.warn("Error updating counting info for resource with ID " + ID);
//e.printStackTrace();
}
return new RemoveResourceResponse();

View File

@ -46,13 +46,14 @@ public class ServiceContext extends GCUBEServiceContext {
protected boolean repeat(Exception exception, int exceptionCount) {
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) {
logger.error("Max attempts reached, no more chance to register the notification resource");
return false;
}
}
return true;
} else*/
return true;
} else
return false;
}
}
@ -60,16 +61,11 @@ public class ServiceContext extends GCUBEServiceContext {
/** Tries to create the resource */
protected class NotificationResource extends GCUBEHandler<Object> {
@SuppressWarnings("unchecked")
public void run() throws Exception {
try {
public void run() throws Exception {
ServiceContext.getContext().setScope(ServiceContext.getContext().getInstance().getScopes().values().toArray(new GCUBEScope[0])[0]);
RegistryFactoryResource resource = (RegistryFactoryResource) FactoryContext.getContext().getWSHome().create(
FactoryContext.getContext().makeKey(RegistryFactory.NOTIFICATOR_RESOURCE_KEY));
resource.getPersistenceDelegate().store(resource );
} catch (Exception e) {
throw e;
}
resource.getPersistenceDelegate().store(resource );
}
}
@ -91,7 +87,7 @@ public class ServiceContext extends GCUBEServiceContext {
//creates the single RegistryResource used to raise notifications about profiles' changes
logger.info("Creating IS-Registry notification resource...");
/*new Thread() {
new Thread() {
public void run() {
try {
Thread.sleep(5000);
@ -102,11 +98,11 @@ public class ServiceContext extends GCUBEServiceContext {
} catch (Exception 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.run();
scheduler.run();*/
logger.info("IS-Registry notification resource registered");