Exemple #1
0
 public override void Run()
 {
     Runner = Thread.CurrentThread;
     try
     {
         Pool.acquire();
         OnAcquire.Signal();
         try
         {
             Latch.acquire();
         }
         catch (InterruptedException e)
         {
             throw new Exception(e);
         }
         if (ReleaseConflict.get())
         {
             Pool.release();
             Released.Signal();
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e.ToString());
         Console.Write(e.StackTrace);
     }
 }
Exemple #2
0
        private ChannelContext AcquireChannelContext(RequestType type)
        {
            if (_channelPool == null)
            {
                throw new ComException(string.Format("Client for {0} is stopped", _destination.ToString()));
            }

            // Calling acquire is dangerous since it may be a blocking call... and if this
            // thread holds a lock which others may want to be able to communicate with
            // the server things go stiff.
            ChannelContext result = _channelPool.acquire();

            if (result == null)
            {
                _msgLog.error("Unable to acquire new channel for " + type);
                throw TraceComException(new ComException("Unable to acquire new channel for " + type), "Client.acquireChannelContext");
            }
            return(result);
        }