[jboss-dev-forums] [IronJacamar Development] - How use AsynchronousServerSocketChannel with JCA 1.6 ?

GOSSET Cédric do-not-reply at jboss.com
Mon Jun 3 10:00:57 EDT 2013


GOSSET Cédric [https://community.jboss.org/people/rockerced] created the discussion

"How use AsynchronousServerSocketChannel with JCA 1.6 ?"

To view the discussion, visit: https://community.jboss.org/message/821009#821009

--------------------------------------------------------------
Hello at all,

I want to develop a AsynchronousServerSocketChannel with NIO.2 by using ThreadGroup with JCA 1.6. But I doesn't know how use AsynchronousChannelGroup with the javax.resource.spi.work.Work interface.
In the example of google jca-sockets implementation. When a new client is accepted (ServerSocket) a work is created to manage socket client.

INBOUND mode in JCA 1.6

Exemple of code for asynchronous server :
    ExecutorService es = Executors.newCachedThreadPool();
    if (es instanceof ThreadPoolExecutor){
    ((ThreadPoolExecutor)es).setMaximumPoolSize(serverInfo.getMaxThread());
    }
    AsynchronousChannelGroup threadGroup = AsynchronousChannelGroup.withCachedThreadPool(es,serverInfo.getMinThread());

    /*server configuration*/
    SocketAddress sa = new InetSocketAddress(Inet4Address.getByName(socketInfo.getHost()), socketInfo.getPort());

    /*server instantiation*/
    server = AsynchronousServerSocketChannel.open(threadGroup).bind(sa);

Thread management is performed by AsynchronousChannelGroup.

Is it necessary to use only ServerSocket for JCA 1.6 implementation ?

Can you give an example of implementation ?

Best regards
GOSSET Cédric
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/821009#821009]

Start a new discussion in IronJacamar Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2099]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20130603/4fdf991d/attachment.html 


More information about the jboss-dev-forums mailing list