jason.core.service
Class TaskService

java.lang.Object
  |
  +--jason.core.AbstractService
        |
        +--jason.core.ThreadableService
              |
              +--jason.core.service.TaskService
All Implemented Interfaces:
java.io.Serializable, Service, ServiceDataListener

public class TaskService
extends ThreadableService

Created Thu May 16 10:01:57 2002

This service has a role for storing a task and process it when possible. This is a kind of queue then get task that service can't handle because they have no ressource for that (like without a thread)

Author:
Alexandre Brillant (abrillant@wanadoo.fr)
See Also:
Serialized Form

Field Summary
static ServiceType TYPE
           
 
Fields inherited from class jason.core.ThreadableService
activeThread
 
Fields inherited from class jason.core.AbstractService
INITIALIZED, name, NOSTATE, serviceContext, STARTED, STOPPED
 
Fields inherited from interface jason.core.Service
ERROR_MESSAGE, INFORMATION_MESSAGE, VERBOSE_MESSAGE, WARNING_MESSAGE
 
Constructor Summary
TaskService()
           
 
Method Summary
protected  void actionForStart()
          We override it not to take into account the initial running
protected  void addTaskInQueue(Task task)
          Store the user task
 ServiceResponse manageRequest(ServiceRequest request)
          Manage all Task object.
protected  void run()
          User should override this method for running a task.
 
Methods inherited from class jason.core.ThreadableService
enableServiceForThread, getThreadLoopDelay, isThreadLoopMode, isThreadStarted, isWaiting, notifyThreadRunning, runThread, setPriority, setThreadLoopDelay, setThreadLoopMode, threadNotify, threadWait
 
Methods inherited from class jason.core.AbstractService
canRestartOnError, checkForContext, fireCriticalErrorDetected, getAutoRestartCounter, getBooleanProperty, getInfo, getIntProperty, getName, getPropertiesName, getProperty, getServiceContext, getServiceState, getState, getStringProperty, getType, getVersion, hasServiceContext, init, isAutoStop, isEnabled, isInitialized, isOverride, isPersistent, isPrivate, isProcessable, isStarted, isStopped, isTest, isThreadable, isVerbose, manageRequestForType, notifyData, notifyInitReady, notifyStartReady, notifyStopReady, postStop, restart, sendCustomMessage, sendErrorMessage, sendInformationMessage, sendInnerError, sendWarningMessage, setAutoRestartCounter, setAutoRestartOnError, setAutoStop, setEnabled, setName, setPersistent, setPrivate, setProperty, setServiceContext, setTest, setType, setVerbose, setVersion, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE

public static ServiceType TYPE
Constructor Detail

TaskService

public TaskService()
Method Detail

manageRequest

public ServiceResponse manageRequest(ServiceRequest request)
                              throws ServiceException
Manage all Task object. If the request doesn't contain this object type, an exception ServiceException is thrown

Specified by:
manageRequest in interface Service
Overrides:
manageRequest in class AbstractService
Parameters:
request - user request with a Task type object
Returns:
the request's response
Throws:
ServiceException - for bad request type

addTaskInQueue

protected void addTaskInQueue(Task task)
Store the user task


actionForStart

protected void actionForStart()
We override it not to take into account the initial running

Overrides:
actionForStart in class ThreadableService

run

protected void run()
Description copied from class: AbstractService
User should override this method for running a task. This is the core of the service running state. Note that you shouldn't use a main loop like for standard thread. You just have to notify that this service use a main loop for the setThreadLoopMode method

Overrides:
run in class AbstractService