springs.access
Class AccessService.RetryingGettingReference

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--springs.util.retries.RetryingTask
              |
              +--springs.access.AccessService.RetryingGettingReference
All Implemented Interfaces:
java.lang.Runnable
Enclosing class:
AccessService

class AccessService.RetryingGettingReference
extends RetryingTask

Note: it seems that the searching could be improved by looking if it is among the local references outside the thread (in a way that we can avoid creating a thread every time): however, the reference could disappeared from the list of local references causing a fail that cannot be captured unless it is within the boundaries of a retrying task.


Field Summary
private  java.lang.String _agentName
           
private  boolean _registerAsObserver
           
 
Fields inherited from class springs.util.retries.RetryingTask
_millisAfterSleep, _millisBetweenIterations, _millisLastTry, _millisLate, _millisNextTry, _millisTillNextTry, _result, maxDelay, minDelay, numRetries, totalDelay
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
AccessService.RetryingGettingReference(java.lang.String agentName, boolean registerAsObserver)
           
 
Method Summary
private  springs.access.AgentReference searchAgent(java.lang.String agentName, boolean registerAsObserver)
          Searches an agent in some remote context.
private  springs.access.AgentReference searchAgentByBruteForce(java.lang.String agentName)
          Searches an agent by brute force in all the contexts.
 void task()
          Performs the task.
 
Methods inherited from class springs.util.retries.RetryingTask
getException, getResult, getSuccess, mainMethod, run, setResult, waitCompletion
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_agentName

private java.lang.String _agentName

_registerAsObserver

private boolean _registerAsObserver
Constructor Detail

AccessService.RetryingGettingReference

public AccessService.RetryingGettingReference(java.lang.String agentName,
                                              boolean registerAsObserver)
Method Detail

task

public void task()
          throws java.lang.Exception
Description copied from class: RetryingTask
Performs the task. This method should be overriden by specific subclasses to perform the desired task.

Overrides:
task in class RetryingTask
Throws:
java.lang.Exception - if error.
See Also:
Exception

searchAgent

private springs.access.AgentReference searchAgent(java.lang.String agentName,
                                                  boolean registerAsObserver)
                                           throws AgentNotFoundException
Searches an agent in some remote context.

Parameters:
agentName - the name of the agent.
registerAsObserver - a boolean indicating whether the context should register itself as an observer for the agent.
Returns:
the agent reference.
AgentNotFoundException
See Also:
AgentReference, String, AgentNotFoundException

searchAgentByBruteForce

private springs.access.AgentReference searchAgentByBruteForce(java.lang.String agentName)
                                                       throws AgentNotFoundException
Searches an agent by brute force in all the contexts.

Parameters:
agentName - the name of the agent.
Returns:
the agent reference.
AgentNotFoundException
See Also:
AgentReference, String, AgentNotFoundException