lumis.portal.processqueue
Class QueueManager

Package class diagram package QueueManager
java.lang.Object
  extended by lumis.portal.processqueue.QueueManager
All Implemented Interfaces:
IProcessQueueManager, IProcessQueueManagerSPI

public class QueueManager
extends Object
implements IProcessQueueManagerSPI

Manager that executes all interactions with the process queue. Implements IProcessQueueManager to execute producing related activities and IProcessQueueManagerSPI to execute consuming related activities.

Since:
6.1.0

Constructor Summary
QueueManager()
          Default constructor.
 
Method Summary
 IQueueTaskProcess getNextQueueTaskProcessForExecution()
          Returns the next task process for execution.
 IQueueStatistics getQueueStatistics()
          Retrieves the current situation statistics of the queue.
 IQueueTaskProcess getTaskProcess(String processId)
          Retrieves the queue item of represented by the processId.
 Collection<IQueueTaskProcess> getTaskProcessByOwnerId(String ownerId)
          Returns the processes of a given owner.
 void removeFromQueue(IQueueTaskProcess item, boolean notifyListeners)
          Removes from queue the current item.
 void reprocess(String processId)
          Triggers the process to be retried.
 IQueueTaskProcess schedule(IQueueTask task, QueueTaskScheduleConfig taskScheduleConfig)
          Schedules the execution of the given task.
 void setFailedStatus(IQueueTaskProcess queueItem)
          Sets the given process the status of QueueTaskProcessStatus.Failed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueueManager

public QueueManager()
Default constructor.

Since:
6.1.0
Method Detail

schedule

public IQueueTaskProcess schedule(IQueueTask task,
                                  QueueTaskScheduleConfig taskScheduleConfig)
                           throws PortalException
Description copied from interface: IProcessQueueManager
Schedules the execution of the given task.

This operation uses the current transactional context. The task will only be available for execution after the transaction is commited. If the transaction is rolled back the scheduling will also be aborted.

Specified by:
schedule in interface IProcessQueueManager
Parameters:
task - the task to be executed.
taskScheduleConfig - contains the configuration for the execution schedule.
Returns:
the scheduled process for that task.
Throws:
PortalException - if the task could not be scheduled.

getTaskProcess

public IQueueTaskProcess getTaskProcess(String processId)
                                 throws PortalException
Description copied from interface: IProcessQueueManager
Retrieves the queue item of represented by the processId.

Specified by:
getTaskProcess in interface IProcessQueueManager
Returns:
the queue item
Throws:
PortalException

getNextQueueTaskProcessForExecution

public IQueueTaskProcess getNextQueueTaskProcessForExecution()
                                                      throws PortalException,
                                                             InterruptedException
Description copied from interface: IProcessQueueManagerSPI
Returns the next task process for execution. This method waits until there is a task process available.

The returned task will already have its status changed to QueueTaskProcessStatus.Running.

Specified by:
getNextQueueTaskProcessForExecution in interface IProcessQueueManagerSPI
Returns:
the task process.
Throws:
PortalException - if there is an error obtaining the process.
InterruptedException - if the current thread is interrupted.

removeFromQueue

public void removeFromQueue(IQueueTaskProcess item,
                            boolean notifyListeners)
                     throws PortalException
Description copied from interface: IProcessQueueManagerSPI
Removes from queue the current item.

Specified by:
removeFromQueue in interface IProcessQueueManagerSPI
Parameters:
item - to be removed from queue.
notifyListeners - if the threads should be waken up.
Throws:
PortalException

setFailedStatus

public void setFailedStatus(IQueueTaskProcess queueItem)
                     throws PortalException
Description copied from interface: IProcessQueueManagerSPI
Sets the given process the status of QueueTaskProcessStatus.Failed.

Specified by:
setFailedStatus in interface IProcessQueueManagerSPI
Parameters:
queueItem - item to be put in failed status.
Throws:
PortalException

getQueueStatistics

public IQueueStatistics getQueueStatistics()
                                    throws PortalException
Description copied from interface: IProcessQueueManager
Retrieves the current situation statistics of the queue.

Specified by:
getQueueStatistics in interface IProcessQueueManager
Returns:
statistics.
Throws:
PortalException

reprocess

public void reprocess(String processId)
               throws PortalException
Description copied from interface: IProcessQueueManager
Triggers the process to be retried.

Specified by:
reprocess in interface IProcessQueueManager
Parameters:
processId - id of the process to be reprocessed.
Throws:
PortalException

getTaskProcessByOwnerId

public Collection<IQueueTaskProcess> getTaskProcessByOwnerId(String ownerId)
                                                      throws PortalException
Description copied from interface: IProcessQueueManager
Returns the processes of a given owner.

Specified by:
getTaskProcessByOwnerId in interface IProcessQueueManager
Parameters:
ownerId - the owner identifier.
Returns:
a collection with the processes.
Throws:
PortalException


Lumisportal  7.0.0.121130 - Copyright © 2006–2012 Lumis EIP Tecnologia da Informação LTDA. All Rights Reserved.