use of org.jboss.remoting.callback.HandleCallbackException in project mage by magefree.
the class RandomString method fireCallback.
public void fireCallback(final ClientCallback call) {
boolean lockSet = false;
try {
if (valid && callBackLock.tryLock(50, TimeUnit.MILLISECONDS)) {
call.setMessageId(messageId.incrementAndGet());
lockSet = true;
Callback callback = new Callback(call);
callbackHandler.handleCallbackOneway(callback);
}
} catch (InterruptedException ex) {
logger.warn("SESSION LOCK - fireCallback - userId: " + userId + " messageId: " + call.getMessageId(), ex);
} catch (HandleCallbackException ex) {
this.valid = false;
managerFactory.userManager().getUser(userId).ifPresent(user -> {
user.setUserState(User.UserState.Disconnected);
logger.warn("SESSION CALLBACK EXCEPTION - " + user.getName() + " userId " + userId + " messageId: " + call.getMessageId() + " - cause: " + getBasicCause(ex).toString());
logger.trace("Stack trace:", ex);
managerFactory.sessionManager().disconnect(sessionId, LostConnection);
});
} catch (Exception ex) {
logger.warn("Unspecific exception:", ex);
} finally {
if (lockSet) {
callBackLock.unlock();
}
}
}
Aggregations