org.aitools.programd.util
Class ManagedProcesses

java.lang.Object
  extended by org.aitools.programd.util.ManagedProcesses

public class ManagedProcesses
extends Object

Controls processes that run in separate threads and need to be shut down before the bot exits.


Constructor Summary
ManagedProcesses(Core coreToUse)
          Creates a ManagedProcesses object.
 
Method Summary
 ManagedProcess get(String name)
          Returns a given process.
 void shutdownAll()
          Shuts down all registered processes.
 void start(ManagedProcess process, String name)
          Adds a process to the registry and starts it.
 Collection<ManagedProcess> values()
          Returns an iterator on the registry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ManagedProcesses

public ManagedProcesses(Core coreToUse)
Creates a ManagedProcesses object.

Parameters:
coreToUse - the Core to which to attach this
Method Detail

start

public void start(ManagedProcess process,
                  String name)
Adds a process to the registry and starts it.

Parameters:
process - the process to add
name - a name by which its thread will be identified

values

public Collection<ManagedProcess> values()
Returns an iterator on the registry.

Returns:
an iterator on the registry

get

public ManagedProcess get(String name)
Returns a given process.

Parameters:
name - the name of the process
Returns:
the process assigned to the name

shutdownAll

public void shutdownAll()
Shuts down all registered processes.