com.sun.sgs.io
Interface Acceptor<T>

Type Parameters:
T - the address family encapsulated by this Acceptor's associated ServerEndpoint
All Known Implementing Classes:
SocketAcceptor

public interface Acceptor<T>

Passively initiates connections by listening on a ServerEndpoint and asynchronously notifies an associated AcceptorListener of each accepted connection.

Once an Acceptor is listening, it will continue to accept incoming connections until its shutdown() method is called. An Acceptor may not be reused once it has started listening or been shut down.


Method Summary
 ServerEndpoint<T> getBoundEndpoint()
          Returns the ServerEndpoint on which this Acceptor is listening.
 ServerEndpoint<T> getEndpoint()
          Returns the ServerEndpoint this Acceptor was created with.
 void listen(AcceptorListener listener)
          Passively accepts incoming connections on the associated ServerEndpoint.
 void shutdown()
          Shuts down this Acceptor, releasing any resources in use.
 

Method Detail

listen

void listen(AcceptorListener listener)
            throws IOException
Passively accepts incoming connections on the associated ServerEndpoint. This call may block until listening succeeds, but does not block to wait for incoming connections. Each accepted connection will result in an asynchronous call to newConnection on the given listener.

Parameters:
listener - the listener that will be notified of new connections
Throws:
IOException - if there was a problem listening on the ServerEndpoint
IllegalStateException - if the Acceptor has been shut down or is already listening

getEndpoint

ServerEndpoint<T> getEndpoint()
Returns the ServerEndpoint this Acceptor was created with.

Returns:
the ServerEndpoint this Acceptor was created with

getBoundEndpoint

ServerEndpoint<T> getBoundEndpoint()
Returns the ServerEndpoint on which this Acceptor is listening.

Returns:
the ServerEndpoint on which this Acceptor is listening
Throws:
IllegalStateException - if the Acceptor has been shut down or was not listening

shutdown

void shutdown()
Shuts down this Acceptor, releasing any resources in use. Once shutdown, an Acceptor cannot be restarted.

Throws:
IllegalStateException - if the Acceptor has been shut down or was not listening

Project Darkstar, Version 0.9.8.2
2013-07-29 20:23:41

Copyright © 2007-2013 Sun Microsystems, Inc. All rights reserved