com.sun.rpc

Class Connection

Known Direct Subclasses:
ConnectDatagram, ConnectSocket

public abstract class Connection
extends Thread

Sets up a connection to the server using either UDP or TCP as determined by the subclass. This class also handles the connection caching.
Author:
Brent Callaghan
See Also:
ConnectSocket, ConnectDatagram

Field Summary

int
port
String
server

Constructor Summary

Connection(String server, int port, String proto, int maxSize)
Construct a new connection to a specified server and port using protocol proto with a reply buffer of size maxsize.

Method Summary

static Connection
getCache(String server, int port, String proto)
Get a cached connection for the specified server, port and protocol
static void
putCache(Connection conn)
Stash a new connection in the cache
void
run()
String
toString()
Return information about the connection

Field Details

port

public int port

server

public String server

Constructor Details

Connection

public Connection(String server,
                  int port,
                  String proto,
                  int maxSize)
Construct a new connection to a specified server and port using protocol proto with a reply buffer of size maxsize.
Parameters:
server - The hostname of the server
port - The port number on the server

Method Details

getCache

public static Connection getCache(String server,
                                  int port,
                                  String proto)
Get a cached connection for the specified server, port and protocol
Parameters:
server - The hostname of the server
port - The port number on the server
proto - The connection type: "tcp" or "udp"

putCache

public static void putCache(Connection conn)
Stash a new connection in the cache
Parameters:

run

public void run()

toString

public String toString()
Return information about the connection