net.officefloor.plugin.socket.server.impl
Class ServerSocketAccepter<CH extends ConnectionHandler>

java.lang.Object
  extended by net.officefloor.frame.util.AbstractSingleTask<ServerSocketAccepter<CH>,None,ServerSocketAccepter.ServerSocketAccepterFlows>
      extended by net.officefloor.plugin.socket.server.impl.ServerSocketAccepter<CH>
All Implemented Interfaces:
TaskFactory<ServerSocketAccepter<CH>,None,ServerSocketAccepter.ServerSocketAccepterFlows>, WorkFactory<ServerSocketAccepter<CH>>, Task<ServerSocketAccepter<CH>,None,ServerSocketAccepter.ServerSocketAccepterFlows>, Work

public class ServerSocketAccepter<CH extends ConnectionHandler>
extends AbstractSingleTask<ServerSocketAccepter<CH>,None,ServerSocketAccepter.ServerSocketAccepterFlows>

Accepts connections.

Author:
Daniel Sagenschneider

Nested Class Summary
static class ServerSocketAccepter.ServerSocketAccepterFlows
          Flow instances for the ServerSocketAccepter.
 
Constructor Summary
ServerSocketAccepter(InetSocketAddress serverSocketAddress, ServerSocketHandler<CH> serverSocketHandler, ConnectionManager<CH> connectionManager, BufferSquirtFactory bufferSquirtFactory)
          Initiate.
 
Method Summary
 void bindToSocket()
          Opens and binds the ServerSocketChannel.
 Object doTask(TaskContext<ServerSocketAccepter<CH>,None,ServerSocketAccepter.ServerSocketAccepterFlows> context)
           
 void unbindFromSocket()
          Unbinds from the ServerSocketChannel.
 
Methods inherited from class net.officefloor.frame.util.AbstractSingleTask
createTask, createWork, getRecycleManagedObjectParameter, registerAsRecycleTask, registerTask, registerTask, registerTask, registerWork
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServerSocketAccepter

public ServerSocketAccepter(InetSocketAddress serverSocketAddress,
                            ServerSocketHandler<CH> serverSocketHandler,
                            ConnectionManager<CH> connectionManager,
                            BufferSquirtFactory bufferSquirtFactory)
                     throws IOException
Initiate.

Parameters:
serverSocketAddress - InetSocketAddress to listen for connections.
serverSocketHandler - ServerSocketHandler.
connectionManager - ConnectionManager.
bufferSquirtFactory - BufferSquirtFactory.
Throws:
IOException - If fails to set up the ServerSocket.
Method Detail

bindToSocket

public void bindToSocket()
                  throws IOException
Opens and binds the ServerSocketChannel.

Throws:
IOException - IOException.

unbindFromSocket

public void unbindFromSocket()
Unbinds from the ServerSocketChannel.


doTask

public Object doTask(TaskContext<ServerSocketAccepter<CH>,None,ServerSocketAccepter.ServerSocketAccepterFlows> context)
              throws Exception
Throws:
Exception


Copyright © 2005-2011. All Rights Reserved.