dk.netarkivet.monitor.jmx
Class CachingProxyConnectionFactory

java.lang.Object
  extended by dk.netarkivet.monitor.jmx.CachingProxyConnectionFactory
All Implemented Interfaces:
JMXProxyConnectionFactory

public class CachingProxyConnectionFactory
extends java.lang.Object
implements JMXProxyConnectionFactory

Adds caching to another JMXProxyFactoryConnectionFactory.


Nested Class Summary
(package private) static class CachingProxyConnectionFactory.CacheKey
          Encapsulates the unit of information for checking the cache.
 
Constructor Summary
CachingProxyConnectionFactory(JMXProxyConnectionFactory wrappedFactory)
          Registers the factory to wrap and initializes connection cache.
 
Method Summary
 JMXProxyConnection getConnection(java.lang.String server, int port, int rmiPort, java.lang.String userName, java.lang.String password)
          If (server,port,userName) has been seen before, looks up the cached connection associated with these values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachingProxyConnectionFactory

public CachingProxyConnectionFactory(JMXProxyConnectionFactory wrappedFactory)
Registers the factory to wrap and initializes connection cache.

Parameters:
wrappedFactory - The factory to add caching to.
Method Detail

getConnection

public JMXProxyConnection getConnection(java.lang.String server,
                                        int port,
                                        int rmiPort,
                                        java.lang.String userName,
                                        java.lang.String password)
If (server,port,userName) has been seen before, looks up the cached connection associated with these values. Otherwise passes the request on the the wrapped factory, caching the result for future reuse.

Specified by:
getConnection in interface JMXProxyConnectionFactory
Parameters:
server - The name of remote server to connect to.
port - The port to connect to on the remote server.
rmiPort - The RMI-port to use in this connection.
userName - The user name to log in as.
password - The password for the specified user.
Returns:
a connection object that can be used for accessing MBeans on the remote server.
See Also:
JMXProxyConnectionFactory.getConnection(String, int, int, String, String)