Added container support for OioDatagramChannelFactory
This commit is contained in:
parent
d01c7e05f9
commit
b6ff3a4cad
@ -27,10 +27,12 @@ import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import org.jboss.netty.channel.socket.ClientSocketChannelFactory;
|
||||
import org.jboss.netty.channel.socket.DatagramChannelFactory;
|
||||
import org.jboss.netty.channel.socket.ServerSocketChannelFactory;
|
||||
import org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory;
|
||||
import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;
|
||||
import org.jboss.netty.channel.socket.oio.OioClientSocketChannelFactory;
|
||||
import org.jboss.netty.channel.socket.oio.OioDatagramChannelFactory;
|
||||
import org.jboss.netty.channel.socket.oio.OioServerSocketChannelFactory;
|
||||
import org.jboss.netty.util.internal.ExecutorUtil;
|
||||
import org.jboss.netty.util.internal.UnterminatableExecutor;
|
||||
@ -72,6 +74,10 @@ public class NettyModule extends AbstractModule {
|
||||
toProvider(NioServerSocketChannelFactoryProvider.class).
|
||||
in(Scopes.SINGLETON);
|
||||
|
||||
bind(DatagramChannelFactory.class).
|
||||
toProvider(OioDatagramChannelFactoryProvider.class).
|
||||
in(Scopes.SINGLETON);
|
||||
|
||||
bind(NioClientSocketChannelFactory.class).
|
||||
toProvider(NioClientSocketChannelFactoryProvider.class).
|
||||
in(Scopes.SINGLETON);
|
||||
@ -87,5 +93,9 @@ public class NettyModule extends AbstractModule {
|
||||
bind(OioServerSocketChannelFactory.class).
|
||||
toProvider(OioServerSocketChannelFactoryProvider.class).
|
||||
in(Scopes.SINGLETON);
|
||||
|
||||
bind(OioDatagramChannelFactory.class).
|
||||
toProvider(OioDatagramChannelFactoryProvider.class).
|
||||
in(Scopes.SINGLETON);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* JBoss, Home of Professional Open Source
|
||||
*
|
||||
* Copyright 2009, Red Hat Middleware LLC, and individual contributors
|
||||
* by the @author tags. See the COPYRIGHT.txt in the distribution for a
|
||||
* full listing of individual contributors.
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this software; if not, write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
||||
*/
|
||||
package org.jboss.netty.container.guice;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
import org.jboss.netty.channel.socket.oio.OioDatagramChannelFactory;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
/**
|
||||
* @author The Netty Project (netty-dev@lists.jboss.org)
|
||||
* @author Trustin Lee (tlee@redhat.com)
|
||||
* @version $Rev$, $Date$
|
||||
*/
|
||||
public class OioDatagramChannelFactoryProvider extends
|
||||
AbstractChannelFactoryProvider<OioDatagramChannelFactory> {
|
||||
|
||||
@Inject
|
||||
public OioDatagramChannelFactoryProvider(
|
||||
@ChannelFactoryResource Executor executor) {
|
||||
super(executor);
|
||||
}
|
||||
|
||||
public OioDatagramChannelFactory get() {
|
||||
return new OioDatagramChannelFactory(executor);
|
||||
}
|
||||
}
|
@ -30,10 +30,12 @@ import java.util.concurrent.Executors;
|
||||
|
||||
import org.jboss.netty.channel.ChannelFactory;
|
||||
import org.jboss.netty.channel.socket.ClientSocketChannelFactory;
|
||||
import org.jboss.netty.channel.socket.DatagramChannelFactory;
|
||||
import org.jboss.netty.channel.socket.ServerSocketChannelFactory;
|
||||
import org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory;
|
||||
import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;
|
||||
import org.jboss.netty.channel.socket.oio.OioClientSocketChannelFactory;
|
||||
import org.jboss.netty.channel.socket.oio.OioDatagramChannelFactory;
|
||||
import org.jboss.netty.channel.socket.oio.OioServerSocketChannelFactory;
|
||||
import org.jboss.netty.logging.InternalLoggerFactory;
|
||||
import org.jboss.netty.logging.OsgiLoggerFactory;
|
||||
@ -70,6 +72,10 @@ public class NettyBundleActivator implements BundleActivator {
|
||||
register(ctx,
|
||||
new NioServerSocketChannelFactory(executor, executor),
|
||||
ServerSocketChannelFactory.class);
|
||||
// ... except for the datagram transport.
|
||||
register(ctx,
|
||||
new OioDatagramChannelFactory(executor),
|
||||
DatagramChannelFactory.class);
|
||||
|
||||
register(ctx, new OioClientSocketChannelFactory(executor));
|
||||
register(ctx, new OioServerSocketChannelFactory(executor, executor));
|
||||
|
@ -89,4 +89,16 @@
|
||||
</parameter>
|
||||
</constructor>
|
||||
</bean>
|
||||
|
||||
<bean mode="On Demand"
|
||||
name="org.jboss.netty.channel.socket.oio.OioDatagramChannelFactory"
|
||||
class="org.jboss.netty.channel.socket.oio.OioDatagramChannelFactory">
|
||||
<alias>org.jboss.netty.channel.socket.DatagramChannelFactory</alias>
|
||||
<depends>org.jboss.netty.internal.ChannelFactoryExecutor</depends>
|
||||
<constructor>
|
||||
<parameter class="java.util.concurrent.Executor">
|
||||
<inject bean="org.jboss.netty.internal.ChannelFactoryExecutor"/>
|
||||
</parameter>
|
||||
</constructor>
|
||||
</bean>
|
||||
</deployment>
|
@ -60,8 +60,16 @@
|
||||
<constructor-arg ref="org.jboss.netty.internal.ChannelFactoryExecutor"/>
|
||||
</bean>
|
||||
|
||||
<bean lazy-init="true" scope="singleton"
|
||||
name="org.jboss.netty.channel.socket.oio.OioDatagramChannelFactory"
|
||||
class="org.jboss.netty.channel.socket.oio.OioDatagramChannelFactory">
|
||||
<constructor-arg ref="org.jboss.netty.internal.ChannelFactoryExecutor"/>
|
||||
</bean>
|
||||
|
||||
<alias name="org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory"
|
||||
alias="org.jboss.netty.channel.socket.ClientSocketChannelFactory" />
|
||||
<alias name="org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory"
|
||||
alias="org.jboss.netty.channel.socket.ServerSocketChannelFactory" />
|
||||
<alias name="org.jboss.netty.channel.socket.oio.OioDatagramChannelFactory"
|
||||
alias="org.jboss.netty.channel.socket.DatagramChannelFactory" />
|
||||
</beans>
|
||||
|
Loading…
Reference in New Issue
Block a user