toolbox.socket
Class SocketConnectionManagerDefaultImpl

Package class diagram package SocketConnectionManagerDefaultImpl
java.lang.Object
  extended by toolbox.socket.SocketConnectionManagerDefaultImpl
All Implemented Interfaces:
SocketConnectionManager

public class SocketConnectionManagerDefaultImpl
extends java.lang.Object
implements SocketConnectionManager

A SocketConnectionManager implementation that creates a new socket for every call to the getSocket method and closes the socket passed to the releaseSocket method.


Constructor Summary
SocketConnectionManagerDefaultImpl()
          Default constructor.
 
Method Summary
 void destroy()
          Destroy this connection manager.
 java.net.Socket getSocket()
          Return a reference to a socket connection.
 void init(XMLProperties xmlProps)
          Initialise the connection manager with the given XMLProperties.
 void releaseSocket(java.net.Socket socket)
          Release a reference to a socket.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SocketConnectionManagerDefaultImpl

public SocketConnectionManagerDefaultImpl()
Default constructor.

Method Detail

init

public void init(XMLProperties xmlProps)
          throws SocketClientException
Initialise the connection manager with the given XMLProperties.

This implementation employs a SocketConfig instance to create socket connections.

Specified by:
init in interface SocketConnectionManager
Parameters:
xmlProps - XML configuration properties
Throws:
SocketClientException - if the manager cannot be initialised.

getSocket

public java.net.Socket getSocket()
                          throws SocketClientException
Return a reference to a socket connection.

Specified by:
getSocket in interface SocketConnectionManager
Returns:
Socket instance
Throws:
SocketClientException

releaseSocket

public void releaseSocket(java.net.Socket socket)
Release a reference to a socket.

Specified by:
releaseSocket in interface SocketConnectionManager
Parameters:
socket - The socket instance to release.

destroy

public void destroy()
Destroy this connection manager.

Specified by:
destroy in interface SocketConnectionManager