verinec.netsim.util.tables
Class ThreadRegistry
java.lang.Object
java.util.AbstractMap
verinec.netsim.util.tables.ThreadRegistry
- All Implemented Interfaces:
- Map
public class ThreadRegistry
- extends AbstractMap
The ThreadRegistry saves the assocation between thread and node. In other
words it saves on which node the thread is running. Since only instance of
the registry is wanted it has no public constructor. Use instead
getInstance()to get an instance of the registry.
- Version:
- $Revision: 47 $
- Author:
- Dominik Jungo
|
Constructor Summary |
private |
ThreadRegistry()
Constructs a new registry. |
| Methods inherited from class java.util.AbstractMap |
clear, clone, containsKey, containsValue, equals, get, hashCode, isEmpty, keySet, putAll, remove, size, toString, values |
entryset
private HashSet entryset
instance
private static ThreadRegistry instance
ThreadRegistry
private ThreadRegistry()
- Constructs a new registry.
getInstance
private static ThreadRegistry getInstance()
- if no instance of the registry exists it creates one otherwise it returns
the already existing one.
- Returns:
- the single instance of the registry
lookup
public static Node lookup(Thread thread)
- looks up on which node a thread is running
- Parameters:
thread - a thread
- Returns:
- the node on which the thread is running
addEntry
public static void addEntry(Thread thread,
Node node)
- adds en thread, node entry to the only existing registry
- Parameters:
thread - a threadnode - node on which the thread is running
entrySet
public Set entrySet()
- Specified by:
entrySet in interface Map- Specified by:
entrySet in class AbstractMap
- See Also:
Map.entrySet()
put
public Object put(Object arg0,
Object arg1)
- Specified by:
put in interface Map- Overrides:
put in class AbstractMap
- See Also:
Map.put(java.lang.Object, java.lang.Object)