net.jini.jeri.connection
Class ServerConnectionManager

java.lang.Object
  extended by net.jini.jeri.connection.ServerConnectionManager

public final class ServerConnectionManager
extends Object

Provides server-side connection management using the Jini extensible remote invocation (Jini ERI) multiplexing protocol to frame and multiplex requests and responses over connections.

A ServerConnectionManager is created by a connection-based ServerEndpoint implemention to manage connections. The handleConnection method is used to manage connections for a particular ServerConnection.

Each session of the Jini ERI multiplexing protocol is mapped to a new request. Request data is read as the data received for the session, and response data is written as the data sent for the session.

Since:
2.0
Author:
Sun Microsystems, Inc.
Implementation Specifics:
This implementation uses the Logger named net.jini.jeri.connection.ServerConnectionManager to log information at the following levels:

Level Description
HANDLED I/O exception initiating handling of a new request on a connection
HANDLED I/O exception initiating multiplexing on a new connection

This implementation uses the Logger named net.jini.jeri.connection.mux to log information at the following levels:

Level Description
WARNING unexpected exception during asynchronous I/O processing, or thread creation failure
HANDLED I/O exception during asynchronous I/O processing
FINEST detailed implementation activity

Nested Class Summary
private static class ServerConnectionManager.Dispatcher
          Request dispatcher wrapper around the request dispatcher passed to handleConnection (i.e., the request dispatcher created by the runtime).
private static class ServerConnectionManager.Inbound
          Inbound request wrapper around the inbound request created by the mux.
private static class ServerConnectionManager.InboundMux
          Subclass wrapper around MuxServer for inbound connections.
 
Field Summary
private static Logger logger
          ServerConnectionManager logger.
 
Constructor Summary
ServerConnectionManager()
          Creates a new ServerConnectionManager.
 
Method Summary
 void handleConnection(ServerConnection conn, RequestDispatcher dispatcher)
          Starts handling requests received on the specified newly accepted connection, dispatching them to the specified request dispatcher asynchronously, and returns immediately.
private static void logThrow(Logger logger, String method, String msg, Object[] args, Exception e)
          Log a throw.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static final Logger logger
ServerConnectionManager logger.

Constructor Detail

ServerConnectionManager

public ServerConnectionManager()
Creates a new ServerConnectionManager.

Method Detail

logThrow

private static void logThrow(Logger logger,
                             String method,
                             String msg,
                             Object[] args,
                             Exception e)
Log a throw.


handleConnection

public void handleConnection(ServerConnection conn,
                             RequestDispatcher dispatcher)
Starts handling requests received on the specified newly accepted connection, dispatching them to the specified request dispatcher asynchronously, and returns immediately.

The Jini ERI multiplexing protocol is started on the connection (as the server). As each request is received, the processRequestData method of the connection will be invoked with the request input stream and the response output stream of the InboundRequest created for the request, to obtain a handle for the request. The checkPermissions method of the connection is then invoked with that handle, and if it returns normally, dispatcher is invoked with the InboundRequest. All of this processing is performed using the same security context in force when this handleConnection method was invoked. The checkPermissions, checkConstraints, and populateContext methods of each InboundRequest created are implemented by delegating to the corresponding method of the connection passing the handle for the request and the other arguments (if any).

The implementation may close the connection if it determines that the client has closed its side of the connection, if there is an unrecoverable problem with the connection, or for other implementation-specific reasons. The caller is responsible for closing the connection when the close method of the associated ListenHandle is invoked.

Parameters:
conn - the server connection
dispatcher - the request dispatcher to use to dispatch requests received on the specified connection
Throws:
NullPointerException - if conn or dispatcher is null


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