use of org.apache.qpid.server.protocol.v0_10.transport.ExecutionErrorCode in project qpid-broker-j by apache.
the class ServerConnection method closeSessionAsync.
public void closeSessionAsync(final ServerSession session, final AMQPConnection.CloseReason reason, final String message) {
final int cause;
switch(reason) {
case MANAGEMENT:
cause = ErrorCodes.CONNECTION_FORCED;
break;
case TRANSACTION_TIMEOUT:
cause = ErrorCodes.RESOURCE_ERROR;
break;
default:
cause = ErrorCodes.INTERNAL_ERROR;
}
addAsyncTask(new Action<ServerConnection>() {
@Override
public void performAction(final ServerConnection conn) {
if (!session.isClosing()) {
ExecutionException ex = new ExecutionException();
ExecutionErrorCode code = ExecutionErrorCode.INTERNAL_ERROR;
try {
code = ExecutionErrorCode.get(cause);
} catch (IllegalArgumentException iae) {
// Ignore, already set to INTERNAL_ERROR
}
ex.setErrorCode(code);
ex.setDescription(message);
session.invoke(ex);
session.close(cause, message);
}
}
});
}
Aggregations