public override FutureResponse AsyncRequest(Command command)
{
int commandId = GetNextCommandId();
command.CommandId = commandId;
command.ResponseRequired = true;
FutureResponse future = new FutureResponse();
Exception priorError = null;
lock(requestMap.SyncRoot)
{
priorError = this.error;
if(priorError == null)
{
requestMap[commandId] = future;
}
}
if(priorError != null)
{
BrokerError brError = new BrokerError();
brError.Message = priorError.Message;
ExceptionResponse response = new ExceptionResponse();
response.Exception = brError;
future.Response = response;
throw priorError;
}
next.Oneway(command);
return future;
}