net.jini.jeri.ssl
Class SslServerEndpointImpl.SslListenHandle

java.lang.Object
  extended by net.jini.jeri.ssl.Utilities
      extended by net.jini.jeri.ssl.SslServerEndpointImpl.SslListenHandle
All Implemented Interfaces:
ServerEndpoint.ListenHandle
Direct Known Subclasses:
HttpsServerEndpoint.HttpsServerEndpointImpl.HttpsListenHandle
Enclosing class:
SslServerEndpointImpl

 class SslServerEndpointImpl.SslListenHandle
extends Utilities
implements ServerEndpoint.ListenHandle

Implements ListenHandle


Nested Class Summary
 
Nested classes/interfaces inherited from class net.jini.jeri.ssl.Utilities
Utilities.SSLContextInfo
 
Field Summary
private  int acceptFailureCount
           
private  long acceptFailureTime
          Used to throttle accept failures
private  boolean closed
          Whether the listen handle has been closed.
private  Set connections
          Set of connections created by this listen handle
private  RequestDispatcher requestDispatcher
          The request handler
private  SecurityContext securityContext
          The security context at the time of the listen.
(package private)  ServerSocket serverSocket
          The server socket used to accept connections
 
Fields inherited from class net.jini.jeri.ssl.Utilities
ANY_KEY_ALGORITHM, clientLogger, DSA_KEY_ALGORITHM, getSubjectPermission, initLogger, INTEGRITY_PREFERRED, INTEGRITY_REQUIRED, RSA_KEY_ALGORITHM, serverLogger, UNKNOWN_PRINCIPAL
 
Constructor Summary
SslServerEndpointImpl.SslListenHandle(RequestDispatcher requestDispatcher, ServerSocket serverSocket)
          Creates a listen handle
 
Method Summary
(package private)  void acceptLoop()
          Handles new socket connections.
 void close()
          Stops listening for requests on the associated ListenEndpoint.
private  boolean continueAfterAcceptFailure(Throwable t)
          Throttles the accept loop after ServerSocket.accept throws an exception, and decides whether to continue at all.
 ServerEndpoint.ListenCookie getCookie()
          Returns a ListenCookie to identify the listen operation as the return value of the ListenContext.addListenEndpoint method.
private  int getPort()
          Returns the port on which this handle is listening.
(package private)  void handleConnection(SslServerEndpointImpl.SslServerConnection connection, RequestDispatcher requestDispatcher)
          Handles a newly accepted server connection.
(package private)  void noteConnectionClosed(SslServerEndpointImpl.SslServerConnection connection)
          Called when a connection is closed without a call to close on this listener.
(package private)  SslServerEndpointImpl.SslServerConnection serverConnection(Socket socket)
          Returns a connection for the specified socket.
 String toString()
          Returns a string representation of this object.
 
Methods inherited from class net.jini.jeri.ssl.Utilities
checkValidity, contains, doesEncryption, doesServerAuthentication, equals, firstX509Cert, getCertFactory, getCipherAlgorithm, getClassName, getClientPrincipals, getClientPrincipals, getClientSSLContextInfo, getKeyAlgorithm, getKeyExchangeAlgorithm, getPermittedKeyAlgorithms, getServerPrincipals, getServerSSLContextInfo, getSupportedCipherSuites, hasStrongCipherAlgorithm, logThrow, maintainsIntegrity, permittedKeyAlgorithm, position, releaseClientSSLContextInfo, safeEquals, subjectString, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

requestDispatcher

private final RequestDispatcher requestDispatcher
The request handler


serverSocket

final ServerSocket serverSocket
The server socket used to accept connections


securityContext

private final SecurityContext securityContext
The security context at the time of the listen.


closed

private boolean closed
Whether the listen handle has been closed.


connections

private final Set connections
Set of connections created by this listen handle


acceptFailureTime

private long acceptFailureTime
Used to throttle accept failures


acceptFailureCount

private int acceptFailureCount
Constructor Detail

SslServerEndpointImpl.SslListenHandle

SslServerEndpointImpl.SslListenHandle(RequestDispatcher requestDispatcher,
                                      ServerSocket serverSocket)
                                throws IOException
Creates a listen handle

Throws:
IOException
Method Detail

acceptLoop

final void acceptLoop()
Handles new socket connections.


continueAfterAcceptFailure

private boolean continueAfterAcceptFailure(Throwable t)
Throttles the accept loop after ServerSocket.accept throws an exception, and decides whether to continue at all. The current code is borrowed from the JRMP implementation; it always continues, but it delays the loop after bursts of failed accepts.


toString

public String toString()
Returns a string representation of this object.

Overrides:
toString in class Object

serverConnection

SslServerEndpointImpl.SslServerConnection serverConnection(Socket socket)
                                                     throws IOException
Returns a connection for the specified socket.

Throws:
IOException

handleConnection

void handleConnection(SslServerEndpointImpl.SslServerConnection connection,
                      RequestDispatcher requestDispatcher)
Handles a newly accepted server connection.


getPort

private int getPort()
Returns the port on which this handle is listening.


close

public void close()
Description copied from interface: ServerEndpoint.ListenHandle
Stops listening for requests on the associated ListenEndpoint.

After this method has returned, no more requests will be dispatched to the RequestDispatcher for the listen operation represented by this ListenHandle, and the listen operation is no longer considered active. This method frees any resources associated with the listen operation.

Invoking this method terminates any requests that have been received because of the listen operation and dispatched to the associated RequestDispatcher but have not yet had their response output stream closed (see InboundRequest.abort); subsequent I/O operations on such requests will fail with an IOException, except some operations that may succeed because they only affect data in local I/O buffers.

Specified by:
close in interface ServerEndpoint.ListenHandle

noteConnectionClosed

void noteConnectionClosed(SslServerEndpointImpl.SslServerConnection connection)
Called when a connection is closed without a call to close on this listener.


getCookie

public ServerEndpoint.ListenCookie getCookie()
Description copied from interface: ServerEndpoint.ListenHandle
Returns a ListenCookie to identify the listen operation as the return value of the ListenContext.addListenEndpoint method.

Specified by:
getCookie in interface ServerEndpoint.ListenHandle
Returns:
a ListenCookie to identify the listen operation


Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.