org.apache.sling.event.impl.jobs.queues
Class OrderedJobQueue

java.lang.Object
  extended by org.apache.sling.event.impl.jobs.StatisticsImpl
      extended by org.apache.sling.event.impl.jobs.queues.AbstractJobQueue
          extended by org.apache.sling.event.impl.jobs.queues.OrderedJobQueue
All Implemented Interfaces:
JobStatusNotifier, Queue, Statistics

public final class OrderedJobQueue
extends AbstractJobQueue

An ordered job queue is processing the queue FIFO in a serialized way. If a job fails it is rescheduled and the reschedule is processed next - this basically means that failing jobs block the queue until they are finished!


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.sling.event.impl.jobs.JobStatusNotifier
JobStatusNotifier.NotifierContext
 
Field Summary
 
Fields inherited from class org.apache.sling.event.impl.jobs.queues.AbstractJobQueue
configuration, isWaiting, logger, queueName, running
 
Fields inherited from interface org.apache.sling.event.impl.jobs.JobStatusNotifier
CONTEXT_PROPERTY_NAME
 
Constructor Summary
OrderedJobQueue(String name, InternalQueueConfiguration config, EnvironmentComponent env)
           
 
Method Summary
 void clear()
          Remove all outstanding jobs from the queue.
 Object getState(String key)
          For monitoring purposes and possible extensions from the different queue types.
 String getStateInfo()
          Return some information about the current state of the queue.
protected  boolean isEmpty()
          Is the queue empty?
protected  void notifyFinished(JobEvent rescheduleInfo)
           
protected  void put(JobEvent event)
          Put another job into the queue.
 void removeAll()
          Remove all outstanding jobs and delete them.
protected  Collection<JobEvent> removeAllJobs()
          Remove all events from the queue and return them.
protected  JobEvent reschedule(JobEvent info)
          Reschedule a job.
 void resume()
          Resume a suspended queue.
protected  JobEvent start(JobEvent processInfo)
           
protected  JobEvent take()
          Get another job from the queue.
 
Methods inherited from class org.apache.sling.event.impl.jobs.queues.AbstractJobQueue
canBeMarkedForRemoval, checkForUnprocessedJobs, close, executeJob, finishedJob, getConfiguration, getName, getStatistics, ignoreException, isMarkedForRemoval, isSuspended, markForRemoval, process, rename, sendAcknowledge, start, suspend
 
Methods inherited from class org.apache.sling.event.impl.jobs.StatisticsImpl
add, addActive, cancelledJob, clearQueued, copyFrom, decQueued, failedJob, finishedJob, getAverageProcessingTime, getAverageWaitingTime, getLastActivatedJobTime, getLastFinishedJobTime, getNumberOfActiveJobs, getNumberOfCancelledJobs, getNumberOfFailedJobs, getNumberOfFinishedJobs, getNumberOfJobs, getNumberOfProcessedJobs, getNumberOfQueuedJobs, getStartTime, incQueued, reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OrderedJobQueue

public OrderedJobQueue(String name,
                       InternalQueueConfiguration config,
                       EnvironmentComponent env)
Method Detail

getStateInfo

public String getStateInfo()
Description copied from interface: Queue
Return some information about the current state of the queue. This method is meant to see the internal state of the queue for debugging or monitoring purposes.

Specified by:
getStateInfo in interface Queue
Overrides:
getStateInfo in class AbstractJobQueue
See Also:
Queue.getStateInfo()

start

protected JobEvent start(JobEvent processInfo)
Specified by:
start in class AbstractJobQueue

resume

public void resume()
Description copied from interface: Queue
Resume a suspended queue. Queue.suspend(). If the queue is not suspended, calling this method has no effect. Depending on the queue implementation, if a job failed a job queue might sleep for a configured time, before a new job is processed. By calling this method, the job queue can be woken up and force an immediate reprocessing. This feature is only supported by ordered queues at the moment. If a queue does not support this feature, calling this method has only an effect if the queue is really supsended.

Specified by:
resume in interface Queue
Overrides:
resume in class AbstractJobQueue
See Also:
Queue.resume()

put

protected void put(JobEvent event)
Description copied from class: AbstractJobQueue
Put another job into the queue.

Specified by:
put in class AbstractJobQueue

take

protected JobEvent take()
Description copied from class: AbstractJobQueue
Get another job from the queue.

Specified by:
take in class AbstractJobQueue

isEmpty

protected boolean isEmpty()
Description copied from class: AbstractJobQueue
Is the queue empty?

Specified by:
isEmpty in class AbstractJobQueue

notifyFinished

protected void notifyFinished(JobEvent rescheduleInfo)
Specified by:
notifyFinished in class AbstractJobQueue

reschedule

protected JobEvent reschedule(JobEvent info)
Description copied from class: AbstractJobQueue
Reschedule a job.

Specified by:
reschedule in class AbstractJobQueue

clear

public void clear()
Description copied from interface: Queue
Remove all outstanding jobs from the queue. This does not delete the jobs. The jobs are either processed by a different cluster node or on restart.

Specified by:
clear in interface Queue
Overrides:
clear in class AbstractJobQueue
See Also:
Queue.clear()

removeAll

public void removeAll()
Description copied from interface: Queue
Remove all outstanding jobs and delete them. This actually cancels all outstanding jobs (but no notifications are send).

Specified by:
removeAll in interface Queue
Overrides:
removeAll in class AbstractJobQueue
See Also:
Queue.removeAll()

removeAllJobs

protected Collection<JobEvent> removeAllJobs()
Description copied from class: AbstractJobQueue
Remove all events from the queue and return them.

Specified by:
removeAllJobs in class AbstractJobQueue

getState

public Object getState(String key)
Description copied from interface: Queue
For monitoring purposes and possible extensions from the different queue types. This method allows to query state information.

Specified by:
getState in interface Queue
Overrides:
getState in class AbstractJobQueue
See Also:
Queue.getState(java.lang.String)


Copyright © 2007-2013 The Apache Software Foundation. All Rights Reserved.