public class ProgressReporter extends java.lang.Thread implements Listener<NegotiationEvent>
NegotiationEvent
s and increases it's internal
counter on each event. It will run in a separate thread and report progress
to the System.out channel (Console by default).Constructor and Description |
---|
ProgressReporter(int numNegotiations)
Initialize a new instance of the ProgressReporter class.
|
Modifier and Type | Method and Description |
---|---|
void |
interrupt()
Called when done with reporting progress.
|
void |
notifyChange(NegotiationEvent data)
Increase progress counter when negotiation event comes in.
|
void |
run()
Report progress to the System.out channel.
|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
public ProgressReporter(int numNegotiations)
numNegotiations
- The total amount of negotiations to do. Progress will increase
up to this number.public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public void interrupt()
interrupt
in class java.lang.Thread
public void notifyChange(NegotiationEvent data)
SwingUtilities.invokeLater(Runnable)
. We recommend to avoid
synchronize as this will can block indefinitely (see notice 1) which
might lead to deadlocks.notifyChange
in interface Listener<NegotiationEvent>
data
- additional data, typically the new value associated with the
event