Class ReferenceCounterUtil
- java.lang.Object
-
- org.apache.activemq.artemis.utils.ReferenceCounterUtil
-
- All Implemented Interfaces:
AutoCloseable,ReferenceCounter
public class ReferenceCounterUtil extends Object implements ReferenceCounter, AutoCloseable
-
-
Constructor Summary
Constructors Constructor Description ReferenceCounterUtil()ReferenceCounterUtil(Runnable runnable)ReferenceCounterUtil(Runnable runnable, Executor executor)ReferenceCounterUtil(Executor executor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheck()Some asynchronous operations (like ack) may delay certain conditions.voidclose()intdecrement()voidexhaust()it will set the value all the way to 0, and execute the task meant for when the value was 0.intgetCount()RunnablegetTask()intincrement()voidsetTask(Runnable task)
-
-
-
Method Detail
-
setTask
public void setTask(Runnable task)
- Specified by:
setTaskin interfaceReferenceCounter
-
getTask
public Runnable getTask()
- Specified by:
getTaskin interfaceReferenceCounter
-
increment
public int increment()
- Specified by:
incrementin interfaceReferenceCounter
-
decrement
public int decrement()
- Specified by:
decrementin interfaceReferenceCounter
-
exhaust
public void exhaust()
it will set the value all the way to 0, and execute the task meant for when the value was 0.
-
check
public void check()
Description copied from interface:ReferenceCounterSome asynchronous operations (like ack) may delay certain conditions. After met, during afterCompletion we may need to recheck certain values to make sure we won't get into a situation where the condition was met asynchronously and queues not removed.- Specified by:
checkin interfaceReferenceCounter
-
getCount
public int getCount()
- Specified by:
getCountin interfaceReferenceCounter
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable
-
-