|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Thread
edu.washington.biostr.sig.brainj3d.core.client.Callback
public class Callback
Title:
Description:
Copyright: Copyright (c) 2003
Company:
A Callback is used to provide communication initiated by the server. This could be done using 2 way RMI, but issues may arise if this were an applet or in the case of a firewall (often firewalls block incoming messages to non registered computers). The system that the callback uses is based on blocking. It initiates communication with the server and blocks until a reponse is returned. A response only comes back when something on the server wants to callback to the client.
When the callback's function completes with a command, it initiates a thread that was provided for that command that initiates the appropriate response. It does nothing if no response was registered for that command. It is the developers responsibility to make sure that the command contains sufficient information so that the right tool will be called.
To use a tool creates a CallbackRunnable that implements the command and then registers the command with the callback. It should already have been started by the Displayer.
| Nested Class Summary | |
|---|---|
protected class |
Callback.Entry
|
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
Thread.State, Thread.UncaughtExceptionHandler |
| Field Summary | |
|---|---|
static int |
CLIENT_MAIN
|
static int |
EVENT_THREAD
|
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
Callback(Session session,
ClientManager manager)
We only have one Callback per client, so this is protected and only called by getCallback(). |
|
| Method Summary | |
|---|---|
void |
addRunnable(String key,
CallbackFactory r)
This adds a command to the set of commands. |
void |
execute(Runnable runnable,
int thread)
|
void |
kill()
|
void |
removeRunnable(String key)
Remove a command. |
void |
run()
The callback runs as a thread and this function does all the work. |
| Methods inherited from class java.lang.Thread |
|---|
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 |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int EVENT_THREAD
public static final int CLIENT_MAIN
| Constructor Detail |
|---|
public Callback(Session session,
ClientManager manager)
session - The current session. This cannot be null.| Method Detail |
|---|
public void execute(Runnable runnable,
int thread)
public void kill()
public void run()
run in interface Runnablerun in class Thread
public void addRunnable(String key,
CallbackFactory r)
key - The command string. This must match the command sent back by the server.r - The CallbackRunnable that performs this command.public void removeRunnable(String key)
key - The command string.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||