Package org.mycore.iview2.services
Class MCRTilingQueue
- All Implemented Interfaces:
Comparable<MCRShutdownHandler.Closeable>
,Iterable<MCRTileJob>
,Collection<MCRTileJob>
,Queue<MCRTileJob>
,MCRShutdownHandler.Closeable
public class MCRTilingQueue
extends AbstractQueue<MCRTileJob>
implements MCRShutdownHandler.Closeable
-
Field Summary
Fields inherited from interface org.mycore.common.events.MCRShutdownHandler.Closeable
DEFAULT_PRIORITY
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Deletes all tile jobs no matter what the current state is.void
close()
does nothingelement()
removes next job.getElementOutOfOrder
(String derivate, String path) get the specific job and alters it status toMCRJobState.PROCESSING
static MCRTilingQueue
int
Returns the priority.iterator()
iterates of jobs of statusMCRJobState.NEW
does not change the status.void
every attached listener is informed that something happened to the state of the queue.boolean
offer
(MCRTileJob job) addsjob
to queue.peek()
get next job without modifying it state toMCRJobState.PROCESSING
poll()
void
Shuts downMCRStalledJobResetter
and does not alter any job anymore.remove()
removes next job.int
removes all jobs from queue for thatderivate
its current status is.int
removes specific job from queue no matter what its current status is.int
size()
returns the current size of this queuetoString()
Methods inherited from class java.util.AbstractQueue
add, addAll
Methods inherited from class java.util.AbstractCollection
contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
contains, containsAll, equals, hashCode, isEmpty, parallelStream, remove, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArray, toArray
Methods inherited from interface org.mycore.common.events.MCRShutdownHandler.Closeable
compareTo
-
Method Details
-
getInstance
- Returns:
- singleton instance of this class
-
poll
- Specified by:
poll
in interfaceQueue<MCRTileJob>
- Returns:
- next available tile job instance
-
remove
removes next job. same aspoll()
but never returns null- Specified by:
remove
in interfaceQueue<MCRTileJob>
- Overrides:
remove
in classAbstractQueue<MCRTileJob>
- Throws:
NoSuchElementException
- ifpoll()
would return null
-
peek
get next job without modifying it state toMCRJobState.PROCESSING
- Specified by:
peek
in interfaceQueue<MCRTileJob>
-
element
removes next job. same aspeek()
but never returns null- Specified by:
element
in interfaceQueue<MCRTileJob>
- Overrides:
element
in classAbstractQueue<MCRTileJob>
- Throws:
NoSuchElementException
- ifpeek()
would return null
-
offer
addsjob
to queue. alters date added to current time and status of job toMCRJobState.NEW
- Specified by:
offer
in interfaceQueue<MCRTileJob>
-
clear
public void clear()Deletes all tile jobs no matter what the current state is.- Specified by:
clear
in interfaceCollection<MCRTileJob>
- Overrides:
clear
in classAbstractQueue<MCRTileJob>
-
iterator
iterates of jobs of statusMCRJobState.NEW
does not change the status.- Specified by:
iterator
in interfaceCollection<MCRTileJob>
- Specified by:
iterator
in interfaceIterable<MCRTileJob>
- Specified by:
iterator
in classAbstractCollection<MCRTileJob>
-
size
public int size()returns the current size of this queue- Specified by:
size
in interfaceCollection<MCRTileJob>
- Specified by:
size
in classAbstractCollection<MCRTileJob>
-
getElementOutOfOrder
get the specific job and alters it status toMCRJobState.PROCESSING
- Throws:
NoSuchElementException
-
notifyListener
public void notifyListener()every attached listener is informed that something happened to the state of the queue. -
remove
removes specific job from queue no matter what its current status is.- Parameters:
derivate
- ID of derivatepath
- absolute image path- Returns:
- the number of jobs deleted
-
remove
removes all jobs from queue for thatderivate
its current status is.- Parameters:
derivate
- ID of derivate- Returns:
- the number of jobs deleted
-
prepareClose
public void prepareClose()Shuts downMCRStalledJobResetter
and does not alter any job anymore.- Specified by:
prepareClose
in interfaceMCRShutdownHandler.Closeable
-
close
public void close()does nothing- Specified by:
close
in interfaceMCRShutdownHandler.Closeable
-
toString
- Overrides:
toString
in classAbstractCollection<MCRTileJob>
- Returns:
- "MCRTilingQueue"
-
getPriority
public int getPriority()Description copied from interface:MCRShutdownHandler.Closeable
Returns the priority. A Closeable with a higher priority will be closed before a Closeable with a lower priority. Default priority is 5.- Specified by:
getPriority
in interfaceMCRShutdownHandler.Closeable
-