net.jini.lookup
Class ServiceDiscoveryManager.LookupCacheImpl.RegisterListenerTask

java.lang.Object
  extended by net.jini.lookup.ServiceDiscoveryManager.CacheTask
      extended by net.jini.lookup.ServiceDiscoveryManager.LookupCacheImpl.RegisterListenerTask
All Implemented Interfaces:
TaskManager.Task, Runnable
Enclosing class:
ServiceDiscoveryManager.LookupCacheImpl

private final class ServiceDiscoveryManager.LookupCacheImpl.RegisterListenerTask
extends ServiceDiscoveryManager.CacheTask

This task class, when executed, first registers to receive ServiceEvents from the given ServiceRegistrar. If the registration process succeeds (no RemoteExceptions), it then executes the LookupTask to query the given ServiceRegistrar for a "snapshot" of its current state with respect to services that match the given template. Note that the order of execution of the two tasks is important. That is, the LookupTask must be executed only after registration for events has completed. This is because when an entity registers with the event mechanism of a ServiceRegistrar, the entity will only receive notification of events that occur "in the future", after the registration is made. The entity will not receive events about changes to the state of the ServiceRegistrar that may have occurred before or during the registration process. Thus, if the order of these tasks were reversed and the LookupTask were to be executed prior to the RegisterListenerTask, then the possibility exists for the occurrence of a change in the ServiceRegistrar's state between the time the LookupTask retrieves a snapshot of that state, and the time the event registration process has completed, resulting in an incorrect view of the current state of the ServiceRegistrar.


Field Summary
 
Fields inherited from class net.jini.lookup.ServiceDiscoveryManager.CacheTask
reg, thisTaskSeqN
 
Constructor Summary
ServiceDiscoveryManager.LookupCacheImpl.RegisterListenerTask(ServiceDiscoveryManager.ProxyReg reg, long seqN)
           
 
Method Summary
 void run()
           
 
Methods inherited from class net.jini.lookup.ServiceDiscoveryManager.CacheTask
getProxyReg, getSeqN, isFromProxy, runAfter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceDiscoveryManager.LookupCacheImpl.RegisterListenerTask

public ServiceDiscoveryManager.LookupCacheImpl.RegisterListenerTask(ServiceDiscoveryManager.ProxyReg reg,
                                                                    long seqN)
Method Detail

run

public void run()
Specified by:
run in interface Runnable
Specified by:
run in class ServiceDiscoveryManager.CacheTask


Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.