|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.fhg.igd.semoa.service.AbstractService
de.fhg.igd.atlas.core.AgentTracerImpl
Provides the function of an Agent Tracer, which tracks the
current location of agents, making use of a locally installed
LSClientService interface.
Agents can be added and removed to a watch list.
In certain update intervals the update daemon initiates lookups
to resolve the current contact addresses of all agents in the
watch list. The corresponding (implicit name, contact address)
correlations can be requested as SortedMap.
LSClientService,
AgentTracerGui| Field Summary | |
protected LSClientService |
clientService_
The reference to a locally installed LSClientService
which is used to lookup the agent's contact addresses. |
private Object |
datalock_
The internal lock object used for synchronisation of watchList respectively tracedAgents_
modifications. |
private static String[] |
DEPEND_
The dependencies to other objects in the global
Environment. |
protected EventReflector |
eventReflector_
The event reflector which is notified, every time a refresh request has been executed successfully. |
private Object |
lock_
The internal lock object used for the tracerThread_. |
int |
LOOKUP_ATTEMPTS
The number of allowed unsuccessful lookups for an agent contact address, before the agent will be removed from the watch list. |
protected Signals |
signals_
Used for for signaling between database and tracerThread. |
protected SortedMap |
tracedAgents_
The current contact addresses of all agents in the watch list are stored in this map. |
protected Thread |
tracerThread_
Thread that provides the functionality of the update daemon. |
protected long |
updateTime_
Update time for the update daemon. |
protected SortedMap |
watchList_
Represents the watch list, which stores the implicit names of the agents and the number of unsuccessful lookups. |
| Fields inherited from class de.fhg.igd.semoa.service.AbstractService |
REV_POSTFIX, REV_PREFIX |
| Fields inherited from interface de.fhg.igd.atlas.core.AgentTracer |
WHATIS |
| Constructor Summary | |
AgentTracerImpl()
Creates a new instance of the agent tracer with the a update time of 1000ms for its update daemon. |
|
AgentTracerImpl(long updateTime)
Creates a new instance of the agent tracer with the given updateTime for its update daemon. |
|
| Method Summary | |
void |
addAgentToWatchList(AgentCard card)
Adds an agent to the agent tracer's watch list. |
void |
addAgentToWatchList(byte[] implicitName)
Adds an agent to the agent tracer's watch list. |
TrustedListener |
addListener(Listener listener)
Adds a Listener. |
String |
author()
Returns the String with the author's name. |
String[] |
dependencies()
Returns the dependencies of this service as described in Service. |
long |
getUpdateTime()
Returns the update interval of the agent tracer. |
String |
info()
Returns the String with the service's short description. |
SortedMap |
list()
Returns a copy of the internally used map which holds the (implicit name, contact address) correlations of the last update. |
String |
printTracedAgents()
Returns the string representation of the stored (implicit name, contact address) correlations. |
void |
refresh()
Initiates a contact address update for all agents in the agent tracer's watch list. |
void |
removeAgentFromWatchList(AgentCard card)
Removes an agent from the agent tracer's watch list. |
void |
removeAgentFromWatchList(byte[] implicitName)
Removes an agent from the agent tracer's watch list. |
String |
revision()
Returns the revision number of this class as a string. |
void |
run()
This method represents the functionality of the update daemon. |
void |
setUpdateTime(long updateTime)
Sets the update interval of the agent tracer. |
private void |
stop()
Stops the tracerThread_. |
String |
toString()
|
| Methods inherited from class de.fhg.igd.semoa.service.AbstractService |
checkDependencies, docs, doPrivileged, doPrivileged, getACC, getEnvironment, majorVersion, minorVersion |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
private static final String[] DEPEND_
Environment.
public final int LOOKUP_ATTEMPTS
protected LSClientService clientService_
LSClientService
which is used to lookup the agent's contact addresses.
protected EventReflector eventReflector_
protected long updateTime_
protected SortedMap watchList_
protected SortedMap tracedAgents_
protected Thread tracerThread_
protected Signals signals_
tracerThread.
private Object lock_
tracerThread_.
private Object datalock_
watchList respectively tracedAgents_
modifications.
| Constructor Detail |
public AgentTracerImpl()
public AgentTracerImpl(long updateTime)
updateTime for its update daemon.
updateTime - The update time in milli seconds.| Method Detail |
public String info()
info in interface Serviceinfo in class AbstractServicepublic String author()
author in interface Serviceauthor in class AbstractServicepublic String revision()
revision in class AbstractServicepublic String[] dependencies()
Service.
dependencies in interface Servicedependencies in class AbstractServicepublic String toString()
toString in class AbstractServicepublic void addAgentToWatchList(AgentCard card)
agentCard
will be registered within the agent tracer and lookups
will be initiated in certain update intervals to resolve
its current contact address.
If the contact address of an agent in the watch list
could not be resolved for a certain number of update cycles,
it is automatically removed from the list, again.
Theadded to the watch list if not already
addAgentToWatchList in interface AgentTracercard - The agent card of the agent.public void addAgentToWatchList(byte[] implicitName)
implicitName
will be registered within the agent tracer and lookups
will be initiated in certain update intervals to resolve
its current contact address.
If the contact address of an agent in the watch list
could not be resolved for a certain number of update cycles,
it is automatically removed from the list, again.
Theadded to the watch list if not already
addAgentToWatchList in interface AgentTracerpublic void removeAgentFromWatchList(AgentCard card)
agentCard
can be found in the watch list, it is removed immediately.
removeAgentFromWatchList in interface AgentTracerpublic void removeAgentFromWatchList(byte[] implicitName)
implicitName
can be found in the watch list, it is removed immediately.
removeAgentFromWatchList in interface AgentTracerimplicitName - The implicit name of the agent.public TrustedListener addListener(Listener listener)
Listener.
The Listener will receive events of the type
String every time an update has been initiated
by the agent tracer's update daemon respectively by a call
of refresh.
Listener instances passed to this method shall be
wrapped in a TrustedListener which is then
returned.
addListener in interface AgentTracerlistener - The Listener to be registered.
TrustedListener that wraps around
the given Listener.
NullPointerException - if listener
is null.public SortedMap list()
Map.Entry consist
of the implicit name of the agent (byte[])
as key and the contact address (URL) as
corresponding value.
If the contact address of an agent could not be resolved
the nth time, a URL of following format
is returned:
error://unknown/n
list in interface AgentTracerpublic void refresh()
refresh in interface AgentTracerpublic long getUpdateTime()
getUpdateTime in interface AgentTracerpublic void setUpdateTime(long updateTime)
updateTime of 0 deactivates the update
mechanism.
setUpdateTime in interface AgentTracerpublic void run()
run in interface Runnableprivate void stop()
tracerThread_.
public String printTracedAgents()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||