streamlined Callback daemon - should no longer shutdown prematurely

This commit is contained in:
BetaSteward 2011-06-11 23:15:02 -04:00
parent 9d385c2ef9
commit a1eb9f7d0e

View file

@ -61,36 +61,24 @@ public class CallbackClientDaemon extends Thread {
@Override @Override
public void run() { public void run() {
try { try {
while(!end) { while(!end && session.isConnected()) {
try { try {
final ClientCallback callback = session.callback(id); final ClientCallback callback = session.callback(id);
session.ack(id, callback.getMessageId()); session.ack(id, callback.getMessageId());
if (callbackExecutor.isShutdown()) if (callbackExecutor.isShutdown())
logger.fatal("Attempt to submit callback to shutdown executor"); logger.fatal("Attempt to submit callback to shutdown executor");
else else
callbackExecutor.submit( client.processCallback(callback);
new Runnable() { } catch (ServerUnavailable ex) {
@Override session.handleServerUnavailable(ex);
public void run() { } catch (Exception ex) {
try { logger.fatal("CallbackClientDaemon failed ", ex);
client.processCallback(callback);
}
catch (Exception ex) {
logger.fatal("CallbackClientDaemon error ", ex);
}
}
}
);
} catch (CallbackException ex) {
logger.fatal("Callback failed ", ex);
} }
} }
} catch (ServerUnavailable ex) { } catch (Exception ex) {
session.handleServerUnavailable(ex);
} catch(MageException ex) {
logger.fatal("CallbackClientDaemon error ", ex); logger.fatal("CallbackClientDaemon error ", ex);
session.disconnect(true);
} }
logger.info("CallbackClientDaemon stopped");
} }
public void stopDaemon() { public void stopDaemon() {