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
protected  QueueTaskProcess createQueueItem(IQueueTask task, String groupId, String title)
          Helper method to create a QueueTaskProcess based on values passed.
protected  QueueTaskProcess createQueueItem(IQueueTask task, String groupId, String title, Date scheduledDate)
          Helper method to create a QueueTaskProcess based on values passed.
 IQueueTaskProcess getNextQueuedItem()
          Retrieves the next QueueItem that is queued state or is in scheduled but the scheduled time has already passed and sets its status to InProgress.
 IQueueTaskProcess getNextScheduledProcess()
          Returns the next scheduled IQueueItem.
 IQueueStatistics getQueueStatistics()
          Retrieves the current situation statistics of the queue.
 IQueueTaskProcess getTaskProcess(String processId)
          Retrieves the queue item of represented by the processId.
 void removeFromQueue(IQueueTaskProcess item, boolean notifyListeners)
          Removes from queue the current item.
 void reprocess(String processId)
          Triggers the process to be retried.
 String schedule(IQueueTask task, Date schedule)
          Schedules an IQueueTask to be executed at a specific time.
 String schedule(IQueueTask task, Date schedule, String group, String title)
          Schedules an IQueueTask to be executed at a specific time, in the specified group, with the informed title.
 String send(IQueueTask task)
          Sends a IQueueTask to be executed.
 String send(IQueueTask task, String groupId)
          Sends a IQueueTask to be executed in within the order of a group.
 String send(IQueueTask task, String groupId, String title)
          Sends an IQueueTask to the queue for a specific group with the given title.
 String send(String title, IQueueTask task)
          Sends an IQueueTask to the queue with the given title.
 void setFailedStatus(IQueueTaskProcess queueItem)
          Sets the given process the status of QueueTaskProcessStatus.Failed.
 void waitForQueueReadyToProcess(long timeout)
          Informs the thread that is is supposed to wait for a process to enter queue or wait timeout before waking up.
 
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

createQueueItem

protected QueueTaskProcess createQueueItem(IQueueTask task,
                                           String groupId,
                                           String title,
                                           Date scheduledDate)
Helper method to create a QueueTaskProcess based on values passed.

Parameters:
task - to be executed
groupId - to execute task in
title - to help identify in queue
scheduledDate - target date/time to execute item in.
Returns:
queued item not yet queued.
Since:
6.1.0

createQueueItem

protected QueueTaskProcess createQueueItem(IQueueTask task,
                                           String groupId,
                                           String title)
Helper method to create a QueueTaskProcess based on values passed.

Parameters:
task - to be executed
groupId - to execute task in
title - to help identify in queue
Returns:
queued item not yet queued.
Since:
6.1.0

send

public String send(IQueueTask task,
                   String groupId)
            throws PortalException
Description copied from interface: IProcessQueueManager
Sends a IQueueTask to be executed in within the order of a group.

Specified by:
send in interface IProcessQueueManager
Parameters:
task - to be executed.
groupId - of the group the task should respect the order.
Returns:
id of the process.
Throws:
PortalException

schedule

public String schedule(IQueueTask task,
                       Date schedule,
                       String group,
                       String title)
                throws PortalException
Description copied from interface: IProcessQueueManager
Schedules an IQueueTask to be executed at a specific time, in the specified group, with the informed title.

Specified by:
schedule in interface IProcessQueueManager
Parameters:
task - to be executed.
schedule - date/time the task is to be executed.
group - group in which the task should be executed.
title - of the task to help identify it in the queue.
Throws:
PortalException

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

send

public String send(IQueueTask task)
            throws PortalException
Description copied from interface: IProcessQueueManager
Sends a IQueueTask to be executed.

Specified by:
send in interface IProcessQueueManager
Parameters:
task - to be executed.
Returns:
id of the process.
Throws:
PortalException

schedule

public String schedule(IQueueTask task,
                       Date schedule)
                throws PortalException
Description copied from interface: IProcessQueueManager
Schedules an IQueueTask to be executed at a specific time.

Specified by:
schedule in interface IProcessQueueManager
Parameters:
task - to be executed.
schedule - date/time the task is to be executed.
Returns:
id of the process.
Throws:
PortalException

getNextQueuedItem

public IQueueTaskProcess getNextQueuedItem()
                                    throws PortalException
Description copied from interface: IProcessQueueManagerSPI
Retrieves the next QueueItem that is queued state or is in scheduled but the scheduled time has already passed and sets its status to InProgress.

Specified by:
getNextQueuedItem in interface IProcessQueueManagerSPI
Returns:
queued item.
Throws:
PortalException

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

send

public String send(String title,
                   IQueueTask task)
            throws PortalException
Description copied from interface: IProcessQueueManager
Sends an IQueueTask to the queue with the given title.

Specified by:
send in interface IProcessQueueManager
Parameters:
title - to help identify the process in the queue.
task - to be executed.
Returns:
id of the process.
Throws:
PortalException

send

public String send(IQueueTask task,
                   String groupId,
                   String title)
            throws PortalException
Description copied from interface: IProcessQueueManager
Sends an IQueueTask to the queue for a specific group with the given title.

Specified by:
send in interface IProcessQueueManager
Parameters:
task - to be executed.
groupId - group in which the task should be executed.
title - of the task to help identify it in the queue.
Returns:
id of the process.
Throws:
PortalException

waitForQueueReadyToProcess

public void waitForQueueReadyToProcess(long timeout)
                                throws InterruptedException
Description copied from interface: IProcessQueueManagerSPI
Informs the thread that is is supposed to wait for a process to enter queue or wait timeout before waking up.

Specified by:
waitForQueueReadyToProcess in interface IProcessQueueManagerSPI
Parameters:
timeout - max time to wait for a process to enter the queue.
Throws:
InterruptedException - when the thread is waken.

getNextScheduledProcess

public IQueueTaskProcess getNextScheduledProcess()
                                          throws PortalException
Description copied from interface: IProcessQueueManagerSPI
Returns the next scheduled IQueueItem. It does not change its status.

Specified by:
getNextScheduledProcess in interface IProcessQueueManagerSPI
Returns:
scheduled item.
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


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