Package org.drasyl.util
Class ReferenceCountUtil
- java.lang.Object
-
- org.drasyl.util.ReferenceCountUtil
-
public final class ReferenceCountUtil extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
release(Object o)
Try to callReferenceCounted.release()
if the specified message implementsReferenceCounted
and is not already released.static void
safeRelease(Object o)
Try to callReferenceCounted.release()
if the specified message implementsReferenceCounted
and is not already released.
-
-
-
Method Detail
-
release
public static boolean release(Object o)
Try to callReferenceCounted.release()
if the specified message implementsReferenceCounted
and is not already released. If the specified message doesn't implementReferenceCounted
, this method does nothing.
-
safeRelease
public static void safeRelease(Object o)
Try to callReferenceCounted.release()
if the specified message implementsReferenceCounted
and is not already released. If the specified message doesn't implementReferenceCounted
, this method does nothing. Unlikerelease(Object)
this method catches an exception raised byReferenceCounted.release()
and logs it, rather than rethrowing it to the caller. It is usually recommended to userelease(Object)
instead, unless you absolutely need to swallow an exception.
-
-