示例#1
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);
        }
示例#2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") private static org.jboss.netty.handler.queue.BlockingReadHandler<org.jboss.netty.buffer.ChannelBuffer> extractBlockingReadHandler(ChannelContext channelContext)
        private static BlockingReadHandler <ChannelBuffer> ExtractBlockingReadHandler(ChannelContext channelContext)
        {
            ChannelPipeline pipeline = channelContext.Channel().Pipeline;

            return((BlockingReadHandler <ChannelBuffer>)pipeline.get(BLOCKING_CHANNEL_HANDLER_NAME));
        }