mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
streamlined Callback daemon - should no longer shutdown prematurely
This commit is contained in:
parent
9d385c2ef9
commit
a1eb9f7d0e
1 changed files with 8 additions and 20 deletions
|
@ -61,36 +61,24 @@ public class CallbackClientDaemon extends Thread {
|
|||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
while(!end) {
|
||||
while(!end && session.isConnected()) {
|
||||
try {
|
||||
final ClientCallback callback = session.callback(id);
|
||||
session.ack(id, callback.getMessageId());
|
||||
if (callbackExecutor.isShutdown())
|
||||
logger.fatal("Attempt to submit callback to shutdown executor");
|
||||
else
|
||||
callbackExecutor.submit(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
client.processCallback(callback);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
logger.fatal("CallbackClientDaemon error ", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
} catch (CallbackException ex) {
|
||||
logger.fatal("Callback failed ", ex);
|
||||
client.processCallback(callback);
|
||||
} catch (ServerUnavailable ex) {
|
||||
session.handleServerUnavailable(ex);
|
||||
} catch (Exception ex) {
|
||||
logger.fatal("CallbackClientDaemon failed ", ex);
|
||||
}
|
||||
}
|
||||
} catch (ServerUnavailable ex) {
|
||||
session.handleServerUnavailable(ex);
|
||||
} catch(MageException ex) {
|
||||
} catch (Exception ex) {
|
||||
logger.fatal("CallbackClientDaemon error ", ex);
|
||||
session.disconnect(true);
|
||||
}
|
||||
logger.info("CallbackClientDaemon stopped");
|
||||
}
|
||||
|
||||
public void stopDaemon() {
|
||||
|
|
Loading…
Reference in a new issue