net.jini.jeri.connection
Class ConnectionManager

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

public final class ConnectionManager
extends Object

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

A ConnectionManager is created by a connection-based Endpoint implemention to manage connections to a particular ConnectionEndpoint. The newRequest method is used to send a request to the connection endpoint.

Each request attempt is mapped to a new session of the Jini ERI multiplexing protocol on an established connection chosen by the ConnectionEndpoint. Request data is written as the data sent for the session, and response data is read as the data recdeived for the session.

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

Level Description
FINEST connection opened or reused

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

This implementation recognizes the following system properties:


Constructor Summary
ConnectionManager(ConnectionEndpoint ep)
          Creates a new ConnectionManager that manages client-side connections to the specified connection endpoint.
 
Method Summary
 OutboundRequestIterator newRequest(OutboundRequestHandle handle)
          Returns an OutboundRequestIterator to use to send a new request for the specified handle to this connection manager's ConnectionEndpoint.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConnectionManager

public ConnectionManager(ConnectionEndpoint ep)
Creates a new ConnectionManager that manages client-side connections to the specified connection endpoint.

Parameters:
ep - the connection endpoint
Method Detail

newRequest

public OutboundRequestIterator newRequest(OutboundRequestHandle handle)
Returns an OutboundRequestIterator to use to send a new request for the specified handle to this connection manager's ConnectionEndpoint.

If the hasNext method of the returned iterator returns true, the next method behaves as follows:

The connection endpoint's connect method is invoked with any active connections that have not reached their maximum number of in-progress requests, any idle connections, and handle. If that returns null, the endpoint's connect method is invoked with handle. In either case, if a new connection is returned, the Jini ERI multiplexing protocol is started on the connection (as the client). Finally, the writeRequestData method of the connection is invoked with handle and the request output stream of the OutboundRequest that is created for the request. If any exception is thrown while obtaining a connection from the endpoint or writing the request data, that exception is thrown to the caller. The OutboundRequest returned by next will invoke the readResponseData method of the connection with the specified handle and the response input stream before any other data is read from the response input stream. The populateContext and getUnfulfilledConstraints methods of the OutboundRequest are implemented by delegating to the corresponding method of the connection passing handle and the other arguments (if any).

The returned iterator might allow continued iteration if the connection used for the most recent request attempt was shut down gracefully by the server.

Parameters:
handle - a handle to identify the request in later invocations on the connection endpoint and its connections
Returns:
an OutboundRequestIterator to use to send a new request for the specified handle to this connection manager's ConnectionEndpoint
Throws:
NullPointerException - if handle is null


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