Search in sources :

Example 6 with LocalAddress

use of org.jboss.netty.channel.local.LocalAddress in project databus by linkedin.

the class SimpleTestServerConnection method start.

public void start(final int localAddr) {
    _shutdownRequested = false;
    _shutdown = false;
    _thread = new Thread(new Runnable() {

        @Override
        public void run() {
            SocketAddress serverAddr = (ServerType.LOCAL == _serverType) ? new LocalAddress(localAddr) : new InetSocketAddress(localAddr);
            //System.err.println("Server running on thread: " + Thread.currentThread());
            _channel = _srvBootstrap.bind(serverAddr);
            _lock.lock();
            try {
                _started = true;
                _startedCondition.signalAll();
                while (!_shutdownRequested) {
                    try {
                        _shutdownReqCondition.await();
                    } catch (InterruptedException ie) {
                    }
                }
                _shutdown = true;
                _shutdownCondition.signalAll();
            } finally {
                _lock.unlock();
            }
        }
    });
    _thread.setDaemon(true);
    _thread.start();
}
Also used : LocalAddress(org.jboss.netty.channel.local.LocalAddress) InetSocketAddress(java.net.InetSocketAddress) SocketAddress(java.net.SocketAddress) InetSocketAddress(java.net.InetSocketAddress)

Aggregations

LocalAddress (org.jboss.netty.channel.local.LocalAddress)6 InetSocketAddress (java.net.InetSocketAddress)2 ServerBootstrap (org.jboss.netty.bootstrap.ServerBootstrap)2 ChannelPipeline (org.jboss.netty.channel.ChannelPipeline)2 DefaultLocalServerChannelFactory (org.jboss.netty.channel.local.DefaultLocalServerChannelFactory)2 HttpRequestDecoder (org.jboss.netty.handler.codec.http.HttpRequestDecoder)2 HttpResponseEncoder (org.jboss.netty.handler.codec.http.HttpResponseEncoder)2 JmxReporter (com.codahale.metrics.JmxReporter)1 GenerateDataEventsRequestProcessor (com.linkedin.databus.container.request.GenerateDataEventsRequestProcessor)1 DatabusEventProducer (com.linkedin.databus.core.util.DatabusEventProducer)1 DatabusEventRandomProducer (com.linkedin.databus.core.util.DatabusEventRandomProducer)1 HttpServerPipelineFactory (com.linkedin.databus2.core.container.netty.HttpServerPipelineFactory)1 EchoRequestProcessor (com.linkedin.databus2.core.container.request.EchoRequestProcessor)1 RequestProcessorRegistry (com.linkedin.databus2.core.container.request.RequestProcessorRegistry)1 SocketAddress (java.net.SocketAddress)1 URI (java.net.URI)1 ChannelFuture (org.jboss.netty.channel.ChannelFuture)1 ChannelPipelineFactory (org.jboss.netty.channel.ChannelPipelineFactory)1 LocalClientChannelFactory (org.jboss.netty.channel.local.LocalClientChannelFactory)1 HttpChunkAggregator (org.jboss.netty.handler.codec.http.HttpChunkAggregator)1