|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.bigdata.service.jini.lookup.ServiceCache
public class ServiceCache
A mapping from ServiceID to ServiceItem that is maintained by
a suitable ServiceDiscoveryManager manager. In order to use this
class, you must register it as the ServiceDiscoveryListener with the
ServiceDiscoveryManager.
Note: instances of this class this will track all services discovered by a
given ServiceDiscoveryManager, not just those that the client
actually uses. This is not a problem since the notification events will be
generated anyway and we will be storing at most 1000s of services in this
map.
| Field Summary | |
|---|---|
protected static org.apache.log4j.Logger |
log
|
| Constructor Summary | |
|---|---|
ServiceCache(net.jini.lookup.ServiceDiscoveryListener listener)
|
|
| Method Summary | |
|---|---|
int |
getServiceCount()
Return the #of known services. |
net.jini.core.lookup.ServiceItem |
getServiceItemByID(net.jini.core.lookup.ServiceID serviceID)
Resolve the ServiceID for a service to the cached
ServiceItem for that service. |
net.jini.core.lookup.ServiceItem[] |
getServiceItems(int maxCount,
net.jini.lookup.ServiceItemFilter filter)
Return an array of cached service items. |
void |
serviceAdded(net.jini.lookup.ServiceDiscoveryEvent e)
Adds the ServiceItem to the internal map to support
#getServiceByID() |
void |
serviceChanged(net.jini.lookup.ServiceDiscoveryEvent e)
updates the map and delegates to the listener. |
void |
serviceRemoved(net.jini.lookup.ServiceDiscoveryEvent e)
This removes the service from the cache. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final transient org.apache.log4j.Logger log
| Constructor Detail |
|---|
public ServiceCache(net.jini.lookup.ServiceDiscoveryListener listener)
listener - An optional delegate listener that will also see the
ServiceDiscoveryEvents observed by this class.| Method Detail |
|---|
public void serviceAdded(net.jini.lookup.ServiceDiscoveryEvent e)
ServiceItem to the internal map to support
#getServiceByID()
Note: This event is generated by the LookupCache. There is an
event for each service as it joins any registrar in the set of registrars
this class is listening. The set of distinct joined services is
accessible via the LookupCache.
serviceAdded in interface net.jini.lookup.ServiceDiscoveryListenerpublic void serviceChanged(net.jini.lookup.ServiceDiscoveryEvent e)
listener.
serviceChanged in interface net.jini.lookup.ServiceDiscoveryListenerpublic void serviceRemoved(net.jini.lookup.ServiceDiscoveryEvent e)
IService and it will still respond to its interface then we DO
NOT remove the service from the cache. This makes the cache more robust
in the face of transient de-registrations of a service. The most common
explanation for those transients is that the host with the service is
swapping and has failed to keep up its pings to the jini registrar(s).
serviceRemoved in interface net.jini.lookup.ServiceDiscoveryListenerpublic net.jini.core.lookup.ServiceItem getServiceItemByID(net.jini.core.lookup.ServiceID serviceID)
ServiceID for a service to the cached
ServiceItem for that service.
serviceID - The ServiceID for the service.
ServiceItem for that service.public int getServiceCount()
public net.jini.core.lookup.ServiceItem[] getServiceItems(int maxCount,
net.jini.lookup.ServiceItemFilter filter)
maxCount - The maximum #of service items to be returned. When zero (0)
all known service items will be returned.filter - An optional filter.
ServiceItems.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||