public class TournamentManager extends java.lang.Thread implements Listenable<NegotiationEvent>
SessionManager
are instantiated. It uses the
configuration object which is created by the user interface and extracts
individual session from configuration object which it wil pass on to the
session manager.
Agents in a tournament must be of class NegotiationParty
.
Constructor and Description |
---|
TournamentManager(MultilateralTournamentConfiguration config)
Initializes a new instance of the
TournamentManager class. |
Modifier and Type | Method and Description |
---|---|
void |
addListener(Listener<NegotiationEvent> listener)
listener support
|
protected java.lang.Object |
clone() |
static java.util.List<NegotiationPartyInternal> |
getPartyList(ExecutorWithTimeout executor,
MultilateralSessionConfiguration config,
SessionsInfo info)
Generate the parties involved in the next round of the tournament
generator.
|
static MultilateralProtocol |
getProtocol(MultiPartyProtocolRepItem protocolRepItem)
Create a new instance of the Protocol object from a
MultiPartyProtocolRepItem |
void |
notifyChange(NegotiationEvent evt)
this is not available for outsiders.
|
void |
removeListener(Listener<NegotiationEvent> listener)
Remove listener for this observable
|
void |
run()
Runnable implementation for thread
|
java.lang.Exception |
runSingleSession(java.util.List<NegotiationPartyInternal> parties,
ExecutorWithTimeout executor)
Run a single session for the given parties (protocol and session are also
used, but extracted from the tournament manager's configuration
|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
public TournamentManager(MultilateralTournamentConfiguration config) throws java.io.IOException, InstantiateException
TournamentManager
class. The tournament
manager uses the provided configuration to find which sessions to run and
how many collections of these sessions (tournaments) to run.config
- The configuration to use for this TournamentInstantiateException
java.io.IOException
public void addListener(Listener<NegotiationEvent> listener)
addListener
in interface Listenable<NegotiationEvent>
listener
- the listener to addpublic void removeListener(Listener<NegotiationEvent> listener)
Listenable
removeListener
in interface Listenable<NegotiationEvent>
listener
- the listener to removepublic void notifyChange(NegotiationEvent evt)
notifyChange
in interface Listenable<NegotiationEvent>
evt
- public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public static java.util.List<NegotiationPartyInternal> getPartyList(ExecutorWithTimeout executor, MultilateralSessionConfiguration config, SessionsInfo info) throws java.util.concurrent.TimeoutException, java.util.concurrent.ExecutionException
executor
- the executor to useconfig
- the MultilateralSessionConfiguration
to useinfo
- the global SessionsInfo
.java.util.concurrent.TimeoutException
- if we run out of time during the construction.java.util.concurrent.ExecutionException
- if one of the agents does not construct properlyprotected java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Thread
java.lang.CloneNotSupportedException
public java.lang.Exception runSingleSession(java.util.List<NegotiationPartyInternal> parties, ExecutorWithTimeout executor)
parties
- the parties to run the tournament for. Must contain at least 1
party. All parties must not be null.public static MultilateralProtocol getProtocol(MultiPartyProtocolRepItem protocolRepItem) throws InstantiateException
MultiPartyProtocolRepItem
InstantiateException
- if failure occurs while constructing the rep item.