mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +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
|
@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() {
|
||||||
|
|
Loading…
Reference in a new issue