HEADER

com.developmentontheedge.jobcontrol
Class FunctionJobControl

com.developmentontheedge.jobcontrol.AbstractJobControl
  |
  +--com.developmentontheedge.jobcontrol.FunctionJobControl

public class FunctionJobControl
extends AbstractJobControl

Provides JobControl functionality for long time performed functions FunctionJobControl is intended for control of function processing. Here the stub demonstrating how FunctionJobControl should be used:

public void function(functionArgumnts, FunctionJobControl control) throws JobControlException
{
try
{

if(control != null)
control.functionStarted();
for(...)
{
if(control != null)
control.checkStatus();
...
if(control != null)
control.setPreparedness( % );
}
if(control != null)
control.functionFinished();
}
catch(Throwable t)
{
if(control != null)
functionTerminatedByError(t);
}
}

Constructor Summary
FunctionJobControl(Category cat)
          Constructs FunctionJobControl
FunctionJobControl(Category cat, JobControlListener l)
          Constructs FunctionJobControl

Method Summary
 voidfunctionFinished(String msg)
          This method should be called when Job is finished successfuly
 voidfunctionFinished()
          This method should be called when Job is finished successfuly
 voidfunctionStarted()
          This method should be called when Job is started
 voidfunctionStarted(String msg)
          This method should be called when Job is started
 voidfunctionTerminatedByError(Throwable t)
          This method should be called when Job is finished by error

Methods inherited from class com.developmentontheedge.jobcontrol.AbstractJobControl
addListener, begin, checkStatus, end, fireValueChanged, format, format, getCreatedTime, getElapsedTime, getEndedTime, getPreparedness, getRemainedTime, getStartedTime, getStatus, getTextStatus, pause, resultsAreReady, resume, run, setPreparedness, terminate

Constructor Detail

FunctionJobControl

public FunctionJobControl(Category cat)
Constructs FunctionJobControl
Parameters:
cat - logging Category

FunctionJobControl

public FunctionJobControl(Category cat, JobControlListener l)
Constructs FunctionJobControl
Parameters:
cat - logging Category
Method Detail

functionFinished

public void functionFinished(String msg)
This method should be called when Job is finished successfuly
Parameters:
msg - detailed message. This message is used for creating of JobControlEvent

functionFinished

public void functionFinished()
This method should be called when Job is finished successfuly

functionStarted

public void functionStarted()
This method should be called when Job is started

functionStarted

public void functionStarted(String msg)
This method should be called when Job is started
Parameters:
msg - detailed message. This message is used for creating of JobControlEvent
See Also:
JobControlEvent

functionTerminatedByError

public void functionTerminatedByError(Throwable t)
This method should be called when Job is finished by error
Parameters:
t - exception that is occured during Job process

Association Links

to Class org.apache.log4j.Category


FOOTER

BOTTOM