public abstract class ActionImpl extends Object implements Action, Runnable
ActionImpl is the superclass of DisplayImpl and CellImpl.
ActionImpl is not Serializable and should not be copied between JVMs.
Modifier and Type | Field and Description |
---|---|
static boolean |
TRACE_STACK |
static boolean |
TRACE_TIME
Indicates whether we print out the trace from where an action is invoked and print its run time
|
Constructor and Description |
---|
ActionImpl(String name)
construct an ActionImpl
|
Modifier and Type | Method and Description |
---|---|
void |
addReference(ThingReference ref)
Creates a link to a ThingReference.
|
boolean |
checkTicks() |
void |
disableAction()
disable activity in this ActionImpl and if necessary wait
for end of current doAction() call
|
abstract void |
doAction()
abstract method that implements activity of this ActionImpl
|
void |
enableAction()
enable activity in this ActionImpl and trigger any pending activity
|
ReferenceActionLink |
findReference(ThingReference ref)
Returns the link associated with a ThingReference.
|
Thread |
getCurrentActionThread()
return Thread currently active in run() method of this
ActionImpl, or null is run() is not active
|
Vector |
getLinks() |
String |
getName() |
static int |
getTaskCount()
return the number of tasks in the threadpool queue
|
static void |
printPool() |
void |
removeAllReferences()
delete all links to ThingReferences
|
void |
removeReference(ThingReference ref)
Removes a link to a ThingReference.
|
void |
run()
invoked by a Thread from the ThreadPool whenever
there is a request for activity in this ActionImpl
|
boolean |
setEnabled(boolean enable)
Set the "enabled" state of this action.
|
void |
setName(String name)
change the name of this Action
|
static void |
setThreadPoolMaximum(int num)
increase the maximum number of Threads allowed in the ThreadPool
|
void |
stop()
stop activity in this ActionImpl
|
static void |
stopThreadPool()
destroy all threads after they've drained the job queue
|
boolean |
thingChanged(ThingChangedEvent e)
a linked ThingReference has changed, requesting activity
in this ActionImpl
|
void |
waitForTasks()
wait for all queued tasks in ThreadPool to finish
|
public static final boolean TRACE_TIME
public static final boolean TRACE_STACK
public ActionImpl(String name)
name
- - String name, used only for debuggingpublic static int getTaskCount()
public static void printPool()
public static void stopThreadPool()
public static void setThreadPoolMaximum(int num) throws Exception
num
- - new maximum number of Threads in ThreadPoolException
- - num is less than previous maximumpublic void stop()
public boolean checkTicks()
public void enableAction()
public void disableAction()
public boolean setEnabled(boolean enable)
ActionImpl action = ...; boolean wasEnabled = action.setEnabled(false); ... action.setEnabled(wasEnabled);
enable
- The new "enabled" state for this action.public Thread getCurrentActionThread()
public void run()
public abstract void doAction() throws VisADException, RemoteException
VisADException
- a VisAD error occurredRemoteException
- an RMI error occurredpublic boolean thingChanged(ThingChangedEvent e) throws VisADException, RemoteException
thingChanged
in interface ThingChangedListener
e
- ThingChangedEvent for change to ThingReferenceVisADException
- a VisAD error occurredRemoteException
- an RMI error occurredpublic void waitForTasks()
public void addReference(ThingReference ref) throws ReferenceException, RemoteVisADException, VisADException, RemoteException
addReference
in interface Action
ref
- The ThingReference to which to create
the link. Subsequent invocation of
thingChanged(ThingChangedEvent)
causes invocation of
ref.acknowledgeThingChanged(this)
. This method invokes
ref.addThingChangedListener(this, ...)
.RemoteVisADException
- if the reference isn't a ThingReferenceImpl
.ReferenceException
- if the reference has already been added.VisADException
- if a VisAD failure occurs.RemoteException
- if a Java RMI failure occurs.thingChanged(ThingChangedEvent)
,
ThingReference.addThingChangedListener(ThingChangedListener, long)
public void removeReference(ThingReference ref) throws VisADException, RemoteException
Removes a link to a ThingReference.
This implementation invokes findReference(ThingReference)
.
removeReference
in interface Action
ref
- The reference to be removed.RemoteVisADException
- if the reference isn't a ThingReferenceImpl
.ReferenceException
- if the reference isn't a part of this
instance.VisADException
- if a VisAD failure occurs.RemoteException
- if a Java RMI failure occurs.public void removeAllReferences() throws VisADException, RemoteException
removeAllReferences
in interface Action
RemoteException
VisADException
public ReferenceActionLink findReference(ThingReference ref) throws VisADException
ref
- The reference to find.ReferenceException
- if the argument is null
.VisADException
- if the argument is null
.public Vector getLinks()
public String getName()
public void setName(String name)
name
- new String nameCopyright © 1996–2023 The SSEC Visualization Project. All rights reserved.