// enqueued by the vns onto the portQueue.
portObject = getPort(portQueue);
port = Integer.parseInt((String) portObject);
} catch (TimeLimitExceededException e) {
e.printStackTrace();
throw new ConnectException(CpmLocalizedMessage.getLocalizedMessage(
CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_EXP_no_service_port__WARNING",
new Object[] { Thread.currentThread().getName() }));
} catch (NumberFormatException e) {
e.printStackTrace();
if (portObject != null && portObject instanceof String) {
throw new ConnectException(CpmLocalizedMessage.getLocalizedMessage(
CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_EXP_invalid_service_port__WARNING",
new Object[] { Thread.currentThread().getName(), (String) portObject }));
} else {
throw new ConnectException(CpmLocalizedMessage.getLocalizedMessage(
CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_EXP_invalid_service_port__WARNING",
new Object[] { Thread.currentThread().getName(), "Not Available" }));
}
} catch (Exception e) {
e.printStackTrace();
if (portObject != null && portObject instanceof String) {
throw new ConnectException(CpmLocalizedMessage.getLocalizedMessage(
CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_EXP_invalid_service_port__WARNING",
new Object[] { Thread.currentThread().getName(), (String) portObject }));
} else {
throw new ConnectException(CpmLocalizedMessage.getLocalizedMessage(
CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_EXP_invalid_service_port__WARNING",
new Object[] { Thread.currentThread().getName(), "Not Available" }));
}
}
// Activate the CasProcessor by instantiating a proxy to the vinci service running
// on a given port.
try {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
UIMAFramework.getLogger(this.getClass()).logrb(
Level.FINEST,
this.getClass().getName(),
"initialize",
CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_activating_service_on_port__FINEST",
new Object[] { Thread.currentThread().getName(), aProcessingContainer.getName(),
String.valueOf(port) });
}
// There is a valid port, so connect to it
activateProcessor(casProcessorConfig, "127.0.0.1", port, aProcessingContainer, redeploy);
} catch (Exception e) {
e.printStackTrace();
throw new ConnectException(e.getMessage());
}
}
}