net.jini.jeri.tcp
Class TcpEndpoint.ConnectionEndpointImpl

java.lang.Object
  extended by net.jini.jeri.tcp.TcpEndpoint.ConnectionEndpointImpl
All Implemented Interfaces:
ConnectionEndpoint
Enclosing class:
TcpEndpoint

private class TcpEndpoint.ConnectionEndpointImpl
extends Object
implements ConnectionEndpoint

ConnectionEndpoint implementation. Instances of this class should never get exposed to anything other than our ConnectionManager, which we trust to operate correctly, so we do not bother to validate request handles and connections passed in.


Constructor Summary
TcpEndpoint.ConnectionEndpointImpl()
           
 
Method Summary
private  void checkResolvePermission()
           
 Connection connect(OutboundRequestHandle handle)
          Invoked by ConnectionManager to create a new connection.
 Connection connect(OutboundRequestHandle handle, Collection active, Collection idle)
          Invoked by ConnectionManager to reuse an existing connection.
private  Socket connectToHost(Constraints.Distilled distilled)
          Returns a socket connected to this endpoint's host and port, according the specified constraints.
private  Socket connectToSocketAddress(SocketAddress socketAddress, Constraints.Distilled distilled)
          Returns a socket connected to the specified address, with a timeout governed by the specified constraints.
private  Socket newSocket()
          Returns a new unconnected socket, using this endpoint's socket factory if non-null.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TcpEndpoint.ConnectionEndpointImpl

TcpEndpoint.ConnectionEndpointImpl()
Method Detail

connect

public Connection connect(OutboundRequestHandle handle)
                   throws IOException
Invoked by ConnectionManager to create a new connection.

Specified by:
connect in interface ConnectionEndpoint
Parameters:
handle - the handle for the request
Returns:
a new connection that can be used to send a request for the specified handle
Throws:
IOException - if an I/O exception occurs

connectToHost

private Socket connectToHost(Constraints.Distilled distilled)
                      throws IOException
Returns a socket connected to this endpoint's host and port, according the specified constraints. If the host name resolves to multiple addresses, attempts to connect to each of them in order until one succeeds.

Throws:
IOException

connectToSocketAddress

private Socket connectToSocketAddress(SocketAddress socketAddress,
                                      Constraints.Distilled distilled)
                               throws IOException
Returns a socket connected to the specified address, with a timeout governed by the specified constraints.

Throws:
IOException

newSocket

private Socket newSocket()
                  throws IOException
Returns a new unconnected socket, using this endpoint's socket factory if non-null.

Throws:
IOException

connect

public Connection connect(OutboundRequestHandle handle,
                          Collection active,
                          Collection idle)
Invoked by ConnectionManager to reuse an existing connection.

Specified by:
connect in interface ConnectionEndpoint
Parameters:
handle - the handle for the request
active - the connections with requests in progress
idle - the connections with no requests in progress
Returns:
a connection that can be used to send an outbound request for the specified handle, or null

checkResolvePermission

private void checkResolvePermission()


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