Class ReferenceCountUtil

java.lang.Object
org.drasyl.util.ReferenceCountUtil

public final class ReferenceCountUtil extends Object
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    Try to call ReferenceCounted.release() if the specified message implements ReferenceCounted and is not already released.
    static void
    Try to call ReferenceCounted.release() if the specified message implements ReferenceCounted and is not already released.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • release

      public static boolean release(Object o)
      Try to call ReferenceCounted.release() if the specified message implements ReferenceCounted and is not already released. If the specified message doesn't implement ReferenceCounted, this method does nothing.
    • safeRelease

      public static void safeRelease(Object o)
      Try to call ReferenceCounted.release() if the specified message implements ReferenceCounted and is not already released. If the specified message doesn't implement ReferenceCounted, this method does nothing. Unlike release(Object) this method catches an exception raised by ReferenceCounted.release() and logs it, rather than rethrowing it to the caller. It is usually recommended to use release(Object) instead, unless you absolutely need to swallow an exception.