}
protected void disableDelegates(List aDelegateList, String aCasReferenceId)
throws AsynchAEException {
if (aDelegateList == null) {
throw new AsynchAEException("Controller:" + getComponentName()
+ " Unable To Disable a Delegate. The Delegate List Provided Is Invalid (Null)");
}
try {
Iterator it = aDelegateList.iterator();
while (it.hasNext()) {
String key = (String) it.next();
Endpoint endpoint = lookUpEndpoint(key, false);
// if the the current delegate is remote, destroy its listener
if (endpoint != null && endpoint.isRemote()) {
Delegate delegate = lookupDelegate(key);
if (delegate != null) {
delegate.cancelDelegateTimer();
}
stopListener(key, endpoint);
endpoint.setStatus(Endpoint.DISABLED);
}
if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, getClass().getName(),
"disableDelegates", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
"UIMAEE_disable_endpoint__INFO", new Object[] { getComponentName(), key });
}
// Change state of the delegate
ServiceInfo sf = getDelegateServiceInfo(key);
if (sf != null) {
sf.setState(ServiceState.DISABLED.name());
}
synchronized (disabledDelegateList) {
disabledDelegateList.add(key);
}
}
if (flowControllerContainer != null) {
try {
synchronized (flowControllerContainer) {
flowControllerContainer.removeAnalysisEngines(aDelegateList);
}
} catch (Exception ex) {
if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.WARNING)) {
UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, CLASS_NAME.getName(),
"disableDelegates", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
"UIMAEE_service_exception_WARNING", getComponentName());
UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, CLASS_NAME.getName(),
"disableDelegates", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
"UIMAEE_exception__WARNING", ex);
}
if (aCasReferenceId != null) {
CasStateEntry parentCasCacheEntry = getLocalCache().getTopCasAncestor(aCasReferenceId);
if (parentCasCacheEntry != null && aDelegateList.size() > 0) {
String delegateKey = (String) aDelegateList.get(0);
if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, CLASS_NAME.getName(),
"disableDelegates", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
"UIMAEE_service_terminating_fc_failure__INFO",
new Object[] { getComponentName(), delegateKey, parentCasCacheEntry.getCasReferenceId() });
}
super.terminate(ex, parentCasCacheEntry.getCasReferenceId());
} else {
terminate();
}
} else {
terminate();
}
return;
}
}
if (!initialized && allTypeSystemsMerged()) {
try {
completeInitialization();
} catch (ResourceInitializationException ex) {
if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.WARNING)) {
UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, CLASS_NAME.getName(),
"disableDelegates", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
"UIMAEE_service_exception_WARNING", getComponentName());
UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, getClass().getName(),
"disableDelegates", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
"UIMAEE_exception__WARNING", ex);
}
handleInitializationError(ex);
return;
}
}
} catch (Exception e) {
if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.WARNING)) {
UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, CLASS_NAME.getName(),
"disableDelegates", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
"UIMAEE_service_exception_WARNING", getComponentName());
UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, getClass().getName(),
"disableDelegates", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
"UIMAEE_exception__WARNING", e);
}
throw new AsynchAEException(e);
}
}