Rio Project 4.2 API Documentation



org.rioproject.resources.client
Class LookupCachePool

java.lang.Object
  extended by org.rioproject.resources.client.LookupCachePool

public class LookupCachePool
extends Object

The LookupCachePool class provides the support to get an existing LookupCache from a pool of created LookupCache instances. Criteria for determining LookupCache matching is based on ServiceTemplate matching

Author:
Dennis Reedy

Nested Class Summary
 class LookupCachePool.SharedLookupCache
          The SharedLookupCache implements a LookupCache and delegates all method invocations to it's LookupDiscoveryManager, and maintains a reference counter for how many clients are sharing the instance.
 
Method Summary
static LookupCachePool getInstance()
          Get the singleton instance of the LookupCachePool
 LookupCache getLookupCache(DiscoveryManagement dMgr, ServiceTemplate template)
          This method will return an instance of LookupCache based on matching the DiscoveryManagement instance and ServiceTemplate provided as criteria.
 LookupCache getLookupCache(String sharedName, String[] groups, LookupLocator[] locators, ServiceTemplate template)
          This method will return an instance of LookupCache based on matching the shared name, shared discovery name, groups, locators and ServiceTemplate provided as criteria.
 void setConfiguration(Configuration conf)
          Set the Configuration property
 void setServiceBeanContainer(ServiceBeanContainer container)
          Set the ServiceBeanContainer
 void terminate()
          For all ServiceDiscoveryManager instances this utility has created, terminate them and set the singleton instance to null;
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static LookupCachePool getInstance()
Get the singleton instance of the LookupCachePool

Returns:
An instance of the LookupCachePool

setServiceBeanContainer

public void setServiceBeanContainer(ServiceBeanContainer container)
Set the ServiceBeanContainer

Parameters:
container - The used for local discovery

setConfiguration

public void setConfiguration(Configuration conf)
Set the Configuration property

Parameters:
conf - The Configuration to use when creating ServiceDiscoveryManager instances

getLookupCache

public LookupCache getLookupCache(DiscoveryManagement dMgr,
                                  ServiceTemplate template)
                           throws IOException,
                                  ConfigurationException
This method will return an instance of LookupCache based on matching the DiscoveryManagement instance and ServiceTemplate provided as criteria. If there is an existing LookupCache instance created by a ServiceDiscoveryManager instance this utility has created that matches the supplied criteria, that instance will be returned.

If the LookupCache can not be found due to not being able to match discovery criteria to a known ServiceDiscoveryManager instance a new ServiceDiscoveryManager instance will be created, then a LookupCache instance created and returned.

If a ServiceDiscoveryManager can be matched, but not a LookupCache, a new LookupCache will be created using the matched ServiceDiscoveryManager

Parameters:
dMgr - A DiscoveryManager instance created by the DiscoveryManagementPool
template - ServiceTemplate to match
Returns:
A ServiceDiscoveryManager object based on the provided parameters or null if the DiscoveryManagement instance was not created by the DiscoveryManagementPool
Throws:
IOException - If discovery management cannot be created
ConfigurationException - If the Jini configuration cannot be used

getLookupCache

public LookupCache getLookupCache(String sharedName,
                                  String[] groups,
                                  LookupLocator[] locators,
                                  ServiceTemplate template)
                           throws IOException,
                                  ConfigurationException
This method will return an instance of LookupCache based on matching the shared name, shared discovery name, groups, locators and ServiceTemplate provided as criteria. If there is an existing LookupCache instance created by a ServiceDiscoveryManager instance this utility has created that matches the supplied criteria, that instance will be returned.

If a LookupCache can not be found due to not being able to match discovery criteria, a new ServiceDiscoveryManager instance will be created using the provided discovery criteria, and a LookupCache instance created and returned.

If a ServiceDiscoveryManager can be matched, but not a LookupCache, a new LookupCache will be created using the matched ServiceDiscoveryManager

Parameters:
sharedName - The name the LookupCache instances are shared across
groups - An array of String objects indicating the Jini Lookup Service groups to discover
locators - An array of LookupLocator objects indicating specific Jini Lookup Service instances to discover
template - ServiceTemplate to match
Returns:
A ServiceDiscoveryManager object based on the provided parameters
Throws:
IOException - If discovery mangement cannot be created
ConfigurationException - If the Jini configuration cannot be used

terminate

public void terminate()
For all ServiceDiscoveryManager instances this utility has created, terminate them and set the singleton instance to null;


Copyright © Rio Project.

Copyright © 2006-2011 Rio Project. All Rights Reserved.