|
JThreadKitTM v1.1.0 ( public members only)
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--com.jthreadkit.AbstractSizeMonitored
|
+--com.jthreadkit.fifo.AbstractFIFO
Partial implementation of the BasicFIFO interface.
Subclasses must implement the #skipImpl method.
InterruptedException - can be thrown from many
of the methods in this class. If one thread is blocked inside
one of these methods and another thread interrupts it,
InterruptedException is thrown by the blocked thread.
TimedOutException - can be thrown from many
of the methods in this class only if the
"use TimedOutException" option is set.
If true is passed to the
setUseTimedOutException()
method, the option is set and TimedOutException will be
thrown from methods that timeout when the specified timeout period
expires. If false is passed, the option is unset and
TimedOutException will never be thrown.
The AbstractSizeMonitored.isUseTimedOutExceptionSet() method returns true
if the option is set and TimedOutException's will be thrown.
TimedOutException is a subclass of RuntimeException
so there is no need for a try-catch block if the option is not set.
This option allows you to determine whether or not a timeout is
an exceptional condition in your context (a condition that
should result in an exception being thrown). If timeouts are routine,
you probably will want to leave this option in its default unset state.
See the class description of
TimedOutException for more information.
ShutdownException - can be thrown from many
of the methods in this class. This exception is not thrown by methods
until the AbstractSizeMonitored.shutdown() method is called. If shutdown() is
never called, this exception will never be thrown and can
be safely ignored. ShutdownException is a subclass of
RuntimeException so there is no need for a try-catch block
if shutdown() won't be called. After shutdown()
is called, any threads that are currently blocked waiting will immediately
throw this exception. In addition, any future calls to methods that would
either result in waiting or would alter the object cause
this exception to be thrown (if no waiting is needed because the condition
is already met, this exception will not be thrown).
See the class description of
ShutdownException for more information.
| Method Summary | |
int |
skip(int atMost)
Skips (deletes) items from the FIFO up to the maximum specified. |
int |
skip(int atMost,
long msTimeout)
Skips (deletes) items from the FIFO up to the maximum specified. |
void |
skipExactly(int exactCount)
Skips (deletes) items from the FIFO exactly matching the count specified. |
int |
skipExactly(int exactCount,
long msTimeout)
Skips (deletes) items from the FIFO exactly matching the count specified if no timeout occurs. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.jthreadkit.AccessibleLock |
getLockObject |
| Methods inherited from interface com.jthreadkit.SimpleShutdown |
shutdown |
| Methods inherited from interface com.jthreadkit.TimedOutExceptionOption |
isUseTimedOutExceptionSet, setUseTimedOutException |
| Method Detail |
public int skip(int atMost,
long msTimeout)
throws InterruptedException,
TimedOutException,
ShutdownException
BasicFIFOatMost.skip in interface BasicFIFOcom.jthreadkit.fifo.BasicFIFOatMost - the number of items to potentially skip. This is
silently reduced to getCapacity() so
specifying values larger than the capacity will have no effect.msTimeout - maximum number of milliseconds to wait. Use
ThreadTools.NO_TIMEOUT (or 0) to indicate that
the waiting should never timeout.atMost. If a timeout occurs, 0 may be returned
or some other number smaller than atMost.InterruptedException - see explanation.TimedOutException - see explanation.ShutdownException - see explanation.
public int skip(int atMost)
throws InterruptedException,
ShutdownException
BasicFIFOskip in interface BasicFIFOcom.jthreadkit.fifo.BasicFIFOatMost - the number of items to potentially skip. This is
silently reduced to getCapacity() so
specifying values larger than the capacity will have no effect.atMost.InterruptedException - see explanation.ShutdownException - see explanation.
public int skipExactly(int exactCount,
long msTimeout)
throws InterruptedException,
TimedOutException,
ShutdownException
BasicFIFOatMost.skipExactly in interface BasicFIFOcom.jthreadkit.fifo.BasicFIFOexactCount - the number of items to skip. This is
not silently reduced. This number can be greater than
the capacity.msTimeout - maximum number of milliseconds to wait. Use
ThreadTools.NO_TIMEOUT (or 0) to indicate that
the waiting should never timeout.atMost if a timeout occured.InterruptedException - see explanation.TimedOutException - see explanation.ShutdownException - see explanation.
public void skipExactly(int exactCount)
throws InterruptedException,
ShutdownException
BasicFIFOskipExactly in interface BasicFIFOcom.jthreadkit.fifo.BasicFIFOexactCount - the number of items to skip. This is
not silently reduced. This number can be greater than
the capacity.InterruptedException - see explanation.ShutdownException - see explanation.
|
JThreadKitTM v1.1.0 ( public members only)
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||