public void run() {
if (listener == null) {
if (listenerAppName == null) {
listenerAppName = appName;
}
sender = new SenderProcess(clusterManagerAddress,
appName,
listenerAppName);
Map<String, String> map = new HashMap<String, String>();
map.put("SenderId", "" + senderId);
sender.setSerializer(new PassThroughSerializer());
sender.acquireTaskAndCreateSender(map);
} else {
Object listenerConfig = null;
try {
listenerConfig = listener.getListenerConfig();
if (listenerConfig == null) {
logger.info("CommLayerEmitter going to wait for listener to acquire task");
synchronized (listener) {
listenerConfig = listener.getListenerConfig();
if (listenerConfig == null) {
listener.wait();
listenerConfig = listener.getListenerConfig();
}
}
}
} catch (Exception e) {
logger.info("Exception in CommLayerEmitter.run()", e);
}
logger.info("Creating sender process with " + listenerConfig);
String destinationAppName = (listenerAppName != null
? listenerAppName : listener.getAppName());
sender = new SenderProcess(listener.getClusterManagerAddress(),
listener.getAppName(),
destinationAppName);
sender.setSerializer(new PassThroughSerializer());
sender.createSenderFromConfig(listenerConfig);