}
}
public Response service(Command command) {
Response response=null;
boolean responseRequired = command.isResponseRequired();
int commandId = command.getCommandId();
try {
response = command.visit(this);
} catch ( Throwable e ) {
if( responseRequired ) {
if( serviceLog.isDebugEnabled() && e.getClass()!=BrokerStoppedException.class )
serviceLog.debug("Error occured while processing sync command: "+e,e);
response = new ExceptionResponse(e);
} else {
serviceException(e);
}
}
if( responseRequired ) {
if( context!=null && context.isDontSendReponse() ) {
// No need to send back a response at this time.
} else {
if( response == null ) {
response = new Response();
}
response.setCorrelationId(commandId);
}
if( context!=null ) {
context.setDontSendReponse(false);
context=null;
}