net.jini.discovery
Class LookupLocatorDiscovery.DiscoveryTask

java.lang.Object
  extended by com.sun.jini.thread.RetryTask
      extended by net.jini.discovery.LookupLocatorDiscovery.DiscoveryTask
All Implemented Interfaces:
TimeConstants, TaskManager.Task, Runnable
Enclosing class:
LookupLocatorDiscovery

private class LookupLocatorDiscovery.DiscoveryTask
extends RetryTask

Task which retrieves elements from the set of undiscoveredLocators and attempts, through the unicast discovery protocol, to discover the lookup service having the LookupLocator referenced by the element. If a particular instance of this class fails to find the lookup service that it references, this task will be rescheduled to be executed again at a later time, using a "backoff strategy" as defined by the method com.sun.jini.thread.RetryTask.retryTime.

See Also:
RetryTask, WakeupManager

Field Summary
private  LookupLocatorDiscovery.LocatorReg reg
           
 
Fields inherited from interface com.sun.jini.constants.TimeConstants
DAYS, HOURS, MINUTES, SECONDS
 
Constructor Summary
LookupLocatorDiscovery.DiscoveryTask(LookupLocatorDiscovery.LocatorReg reg, TaskManager taskMgr, WakeupManager wakeupMgr)
           
 
Method Summary
 long retryTime()
          Returns the next absolute time (in milliseconds) at which another attempt to discover the lookup service referenced in this class should be made.
 boolean runAfter(List tasks, int size)
          Returns true if current instance must be run after task(s) in task manager queue.
 boolean tryOnce()
          Executes the current instance of this task once, attempting to discover - through unicast discovery - the lookup service referenced in that instance.
 
Methods inherited from class com.sun.jini.thread.RetryTask
attempt, cancel, cancelled, complete, reset, run, startTime, waitFor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

reg

private LookupLocatorDiscovery.LocatorReg reg
Constructor Detail

LookupLocatorDiscovery.DiscoveryTask

public LookupLocatorDiscovery.DiscoveryTask(LookupLocatorDiscovery.LocatorReg reg,
                                            TaskManager taskMgr,
                                            WakeupManager wakeupMgr)
Method Detail

tryOnce

public boolean tryOnce()
Executes the current instance of this task once, attempting to discover - through unicast discovery - the lookup service referenced in that instance. Upon successfully discovering the indicated lookup service, this method returns true and the current instance of this task is not executed again. For each unsuccessful discovery attempt made by this method for the current instance of this task, this method returns false, which causes the task to be scheduled by the WakeupManager to be executed again at a later time as indicated by the value returned by retryTime.

Specified by:
tryOnce in class RetryTask

retryTime

public long retryTime()
Returns the next absolute time (in milliseconds) at which another attempt to discover the lookup service referenced in this class should be made. Overrides the version of this method in the parent class.

Overrides:
retryTime in class RetryTask

runAfter

public boolean runAfter(List tasks,
                        int size)
Returns true if current instance must be run after task(s) in task manager queue.

Parameters:
tasks - the tasks to consider.
size - elements with index less than size are considered.


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