{
logger.entering(DestroySharedGroup.class.getName(), "destroy",
new Object[] {Arrays.asList(srvArray), config} );
Created created = null;
SharedActivatableServiceDescriptor desc = null;
ActivationSystem activationSystem = null;
for (int i=0; i < srvArray.length; i++) {
if (srvArray[i] instanceof SharedActivatableServiceDescriptor) {
desc = (SharedActivatableServiceDescriptor)srvArray[i];
activationSystem =
ServiceStarter.getActivationSystem(
desc.getActivationSystemHost(),
desc.getActivationSystemPort(),
config);
try {
created = (Created)desc.create(config);
if (created != null &&
created.proxy instanceof SharedGroup) {
// service proxy from create() is already prepared
SharedGroup sg = (SharedGroup)created.proxy;
try {
sg.destroyVM();
try {
File log = new File(desc.getSharedGroupLog());
FileSystem.destroy(log, true);
} catch (Exception e) {
logger.log(Level.WARNING,
"destroy.group.deletion", e);
}
} catch (Exception e ) {
logger.log(Level.SEVERE,
"destroy.group.exception", e);
//TODO - Add configurable retry logic or just unregister
}
} else {
logger.log(Level.WARNING, "destroy.unexpected.proxy",
(created==null)?null:created.proxy);
if (created != null && created.aid != null) {
try {
activationSystem.unregisterObject(created.aid);
} catch (Exception e) {
logger.log(Level.WARNING,
"destroy.unregister.exception", e) ;
}
}
}
} catch (Exception ee) {
logger.log(Level.SEVERE, "destroy.creation.exception", ee);
if (created != null && created.aid != null) {
try {
activationSystem.unregisterObject(created.aid);
} catch (Exception e) {
logger.log(Level.WARNING,
"destroy.unregister.exception", ee) ;
}
}