Package org.apache.camel.util
Class ReferenceCount
- java.lang.Object
-
- org.apache.camel.util.ReferenceCount
-
public final class ReferenceCount extends Object
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description longget()Returns the reference count.static ReferenceCounton(Runnable onFirst, Runnable onRelease)static ReferenceCountonRelease(Runnable onRelease)voidrelease()Decreases the reference count and invoke onRelease if the reference count reaches0.voidretain()Increases the reference count invoke onFirst on the first increment;
-
-
-
Method Detail
-
get
public long get()
Returns the reference count.
-
retain
public void retain() throws IllegalStateException
Increases the reference count invoke onFirst on the first increment;- Throws:
IllegalStateException
-
release
public void release() throws IllegalStateException
Decreases the reference count and invoke onRelease if the reference count reaches0.- Throws:
IllegalStateException
-
on
public static ReferenceCount on(Runnable onFirst, Runnable onRelease)
-
onRelease
public static ReferenceCount onRelease(Runnable onRelease)
-
-