Package org.apache.sling.event.impl.jobs.queues

# Class JobQueueImpl

java.lang.Object
org.apache.sling.event.impl.jobs.queues.JobQueueImpl

All Implemented Interfaces:
  `org.apache.sling.event.jobs.Queue`

public class JobQueueImpl extends Object implements org.apache.sling.event.jobs.Queue
The job blocking queue extends the blocking queue by some functionality for the job event handling.

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`JobQueueImpl(String name, InternalQueueConfiguration config, QueueServices services, QueueJobCache cache, org.apache.sling.event.impl.jobs.queues.OutdatedJobQueueInfo outdatedQueue)`
Create a new queue.

## Method Summary

Modifier and Type
Method
Description
`void`
`close()`
Close this queue.
`static JobQueueImpl`
`createQueue(String name, InternalQueueConfiguration config, QueueServices services, Set<String> topics, Set<String> haltedTopicsBackRef, org.apache.sling.event.impl.jobs.queues.OutdatedJobQueueInfo outdatedQueueInfo)`
Create a new queue.
`InternalQueueConfiguration`
`getConfiguration()`
Return the queue configuration
`String`
`getName()`
Get the name of the job queue.
`Object`
`getState(String key)`
`String`
`getStateInfo()`
`org.apache.sling.event.jobs.Statistics`
`getStatistics()`
`boolean`
`isSuspended()`
`void`
`maintain()`
Periodic maintenance
`void`
`outdate()`
Outdate this queue.
`void`
`removeAll()`
`void`
`resume()`
`void`
`startJobs()`
Start the job queue.
`void`
`stopAllJobs()`
Stop all currently running jobs in this queue
`boolean`
`stopJob(JobImpl job)`
`void`
`suspend()`
`boolean`
`tryToClose()`
Check if the queue can be closed
`void`
`wakeUpQueue(Set<String> topics)`
Inform the queue about new job for the given topics.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### JobQueueImpl

protected JobQueueImpl(String name, InternalQueueConfiguration config, QueueServices services, QueueJobCache cache, org.apache.sling.event.impl.jobs.queues.OutdatedJobQueueInfo outdatedQueue)
Create a new queue.

Parameters:
  `name` - The queue name
  `config` - The queue configuration
  `services` - The queue services
  `cache` - The job cache
  `outdatedQueue` -

## Method Details

### createQueue

public static JobQueueImpl createQueue(String name, InternalQueueConfiguration config, QueueServices services, Set<String> topics, Set<String> haltedTopicsBackRef, org.apache.sling.event.impl.jobs.queues.OutdatedJobQueueInfo outdatedQueueInfo)
Create a new queue.

Parameters:
  `name` - The queue name
  `config` - The queue configuration
  `services` - The queue services
  `topics` - The topics handled by this queue
  `haltedTopicsBackRef` - reference to pass newly halted topics back
  `outdatedQueueInfo` -
Returns:
  `JobQueueImpl` if there are jobs to process, `null` otherwise.

### getConfiguration

public InternalQueueConfiguration getConfiguration()
Return the queue configuration

Specified by:
  `getConfiguration` in interface `org.apache.sling.event.jobs.Queue`

### getName

public String getName()
Get the name of the job queue.

Specified by:
  `getName` in interface `org.apache.sling.event.jobs.Queue`

### getStatistics

public org.apache.sling.event.jobs.Statistics getStatistics()

Specified by:
  `getStatistics` in interface `org.apache.sling.event.jobs.Queue`
See Also:
  - `Queue.getStatistics()`

### startJobs

public void startJobs()
Start the job queue. This method might be called concurrently, therefore we use a guard

### outdate

public void outdate()
Outdate this queue.

### tryToClose

public boolean tryToClose()
Check if the queue can be closed

### close

public void close()
Close this queue.

### maintain

public void maintain()
Periodic maintenance

### wakeUpQueue

public void wakeUpQueue(Set<String> topics)
Inform the queue about new job for the given topics.

Parameters:
  `topics` - the new topics

### resume

public void resume()

Specified by:
  `resume` in interface `org.apache.sling.event.jobs.Queue`
See Also:
  - `Queue.resume()`

### suspend

public void suspend()

Specified by:
  `suspend` in interface `org.apache.sling.event.jobs.Queue`
See Also:
  - `Queue.suspend()`

### isSuspended

public boolean isSuspended()

Specified by:
  `isSuspended` in interface `org.apache.sling.event.jobs.Queue`
See Also:
  - `Queue.isSuspended()`

### removeAll

public void removeAll()

Specified by:
  `removeAll` in interface `org.apache.sling.event.jobs.Queue`
See Also:
  - `Queue.removeAll()`

### getState

public Object getState(String key)

Specified by:
  `getState` in interface `org.apache.sling.event.jobs.Queue`
See Also:
  - `Queue.getState(java.lang.String)`

### getStateInfo

public String getStateInfo()

Specified by:
  `getStateInfo` in interface `org.apache.sling.event.jobs.Queue`
See Also:
  - `Queue.getStateInfo()`

### stopJob

public boolean stopJob(JobImpl job)

### stopAllJobs

public void stopAllJobs()
Stop all currently running jobs in this queue