예제 #1
0
        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;
        }
예제 #2
0
		private void Dispose(Exception error)
		{
			ArrayList requests = null;
			
	        lock(requestMap.SyncRoot) 
			{
	            if(this.error == null) 
				{
	                this.error = error;
	                requests = new ArrayList(requestMap.Values);
	                requestMap.Clear();
	            }
	        }
			
	        if(requests != null)
			{
				foreach(FutureResponse future in requests)
				{
					BrokerError brError = new BrokerError();
					brError.Message = error.Message;
					ExceptionResponse response = new ExceptionResponse();
					response.Exception = brError;
		            future.Response = response;
				}
	        }
		}