|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object charly.client.ChTask
This class manages the ressources needed for a task.
First add resources through addResource( ChConnect, String)
.
Then call start(boolean)
.
After performing the task call stop()
;
this frees the ressources in order to allow other users to get access.
Nested Class Summary | |
(package private) class |
ChTask.ChClientTaskRepresentation
This class is for intern use only. |
Field Summary | |
protected ChConnect |
conn
|
protected java.lang.String |
name
|
(package private) ChTask.ChClientTaskRepresentation |
representation
|
protected java.util.Set |
rsrcs
|
protected boolean |
starting
This variable is used to wait for the start. |
protected java.lang.String |
taskID
|
protected java.util.LinkedList |
taskListeners
|
Constructor Summary | |
ChTask(ChConnect conn,
java.lang.String taskName)
Constructor. |
|
ChTask(java.lang.String taskName)
|
Method Summary | |
void |
addResource(ChConnect conn,
java.lang.String rsrc)
adds a resource to the task. |
void |
addResource(ChResource rsrc)
adds a resource to the task. |
void |
addTaskListener(ChTaskListener l)
|
private void |
assertConn(ChConnect conn)
this method only exists until more than one ChConnect is supported. |
private static boolean |
compare(java.lang.Object cmp1,
java.lang.Object cmp2)
|
protected void |
finalize()
calls stop() |
protected void |
fireTaskAbortedEvent()
|
protected void |
fireTaskStartedEvent()
|
protected void |
fireTaskStoppedEvent()
|
java.lang.String |
getName()
returns the name of the task |
java.lang.String |
getTaskID()
returns the taskID, the task got from the server. |
boolean |
isStarted()
returns true, if the task has been started and not yet stopped or aborted. |
void |
removeResource(ChConnect conn,
java.lang.String rsrc)
removes a resource to the task. |
void |
removeTaskListener(ChTaskListener l)
|
protected void |
setTaskID(java.lang.String taskID)
is called by ChTask.ChClientTaskRepresentation.taskStarted(String) |
void |
start(boolean wait)
Before using the resources this method should be called. |
void |
stop()
normal end of task. |
protected void |
waitForAcceptance()
it simply calls this.wait() . |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.lang.String name
protected java.util.Set rsrcs
protected ChConnect conn
protected java.util.LinkedList taskListeners
ChTask.ChClientTaskRepresentation representation
protected volatile boolean starting
waitForAcceptance()
,
start(boolean)
protected java.lang.String taskID
Constructor Detail |
public ChTask(ChConnect conn, java.lang.String taskName)
conn
- - connection to the server. If this
parameter is omitted, the connection is taken
from the first added resourcetaskName
- - name of the taskpublic ChTask(java.lang.String taskName)
Method Detail |
protected void fireTaskStartedEvent()
protected void fireTaskAbortedEvent()
protected void fireTaskStoppedEvent()
public void addTaskListener(ChTaskListener l)
public void removeTaskListener(ChTaskListener l)
private static final boolean compare(java.lang.Object cmp1, java.lang.Object cmp2)
protected void setTaskID(java.lang.String taskID)
ChTask.ChClientTaskRepresentation.taskStarted(String)
public java.lang.String getTaskID()
public boolean isStarted()
public java.lang.String getName()
public void start(boolean wait) throws java.rmi.RemoteException, java.net.MalformedURLException, ChAlreadyStartingException, java.rmi.NotBoundException, ChAlreadyStartedException, ChNoRsrcsAddedException
wait
- if true
the method waits until
the task is started on the server.
java.rmi.RemoteException
java.net.MalformedURLException
ChAlreadyStartingException
java.rmi.NotBoundException
ChAlreadyStartedException
ChNoRsrcsAddedException
protected void waitForAcceptance()
this.wait()
. A standard task listener will
call this.notify().
ChTask(String)
public void stop()
protected void finalize() throws java.lang.Throwable
stop()
java.lang.Throwable
public void addResource(ChConnect conn, java.lang.String rsrc)
conn
are supported, which means that
in every call to addRsrc
of a certain task the parameter
conn
should be
the same.
addResource(ChResource)
public void addResource(ChResource rsrc)
rsrc.ChResource.setTask(ChTask)
. Currently,
only resources of a single conn
are supported, which means that
in every call to addRsrc
of a certain task the parameter
conn
should be
the same.
- See Also:
addResource(ChConnect,String)
public void removeResource(ChConnect conn, java.lang.String rsrc)
private void assertConn(ChConnect conn)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |