verinec.netsim.util.tables
Class ThreadRegistry

java.lang.Object
  extended by java.util.AbstractMap
      extended by 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

Nested Class Summary
private  class ThreadRegistry.Entry
           
 
Field Summary
private  HashSet entryset
           
private static ThreadRegistry instance
           
 
Constructor Summary
private ThreadRegistry()
          Constructs a new registry.
 
Method Summary
static void addEntry(Thread thread, Node node)
          adds en thread, node entry to the only existing registry
 Set entrySet()
           
private static ThreadRegistry getInstance()
          if no instance of the registry exists it creates one otherwise it returns the already existing one.
static Node lookup(Thread thread)
          looks up on which node a thread is running
 Object put(Object arg0, Object arg1)
           
 
Methods inherited from class java.util.AbstractMap
clear, clone, containsKey, containsValue, equals, get, hashCode, isEmpty, keySet, putAll, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

entryset

private HashSet entryset

instance

private static ThreadRegistry instance
Constructor Detail

ThreadRegistry

private ThreadRegistry()
Constructs a new registry.

Method Detail

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 thread
node - 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)

Copyright © 2005 Verinec, DIUF