Exemple #1
0
		/// <exception cref="System.IO.IOException"></exception>
		public virtual void Sendrecv(ServerMessageBlock request, Response response, long timeout)
		{
			lock (this)
			{
				MakeKey(request);
				response.IsReceived = false;
				try
				{
					ResponseMap.Put(request, response);
					DoSend(request);
					response.Expiration = Runtime.CurrentTimeMillis() + timeout;
					while (!response.IsReceived)
					{
						Runtime.Wait(this, timeout);
						timeout = response.Expiration - Runtime.CurrentTimeMillis();
						if (timeout <= 0)
						{
							throw new TransportException(Name + " timedout waiting for response to " + request
								);
						}
					}
				}
				catch (IOException ioe)
				{
					if (Log.Level > 2)
					{
						Runtime.PrintStackTrace(ioe, Log);
					}
					try
					{
						Disconnect(true);
					}
					catch (IOException ioe2)
					{
						Runtime.PrintStackTrace(ioe2, Log);
					}
					throw;
				}
				catch (Exception ie)
				{
					throw new TransportException(ie);
				}
				finally
				{
					//Sharpen.Collections.Remove(response_map, request);
                    ResponseMap.Remove(request);
				}
			}
		}
Exemple #2
0
		/// <exception cref="System.IO.IOException"></exception>
		protected internal abstract void DoRecv(Response response);