ReferenceCountUtil

Collection of method to handle objects that may implement {@link ReferenceCounted}.

Members

Static functions

release
bool release(Object msg)

Try to call {@link ReferenceCounted#release()} if the specified message implements {@link ReferenceCounted}. If the specified message doesn't implement {@link ReferenceCounted}, this method does nothing.

release
bool release(Object msg, int decrement)

Try to call {@link ReferenceCounted#release(int)} if the specified message implements {@link ReferenceCounted}. If the specified message doesn't implement {@link ReferenceCounted}, this method does nothing.

safeRelease
void safeRelease(Object msg)

Try to call {@link ReferenceCounted#release()} if the specified message implements {@link ReferenceCounted}. If the specified message doesn't implement {@link ReferenceCounted}, this method does nothing. Unlike {@link #release(Object)} this method catches an exception raised by {@link ReferenceCounted#release()} and logs it, rather than rethrowing it to the caller. It is usually recommended to use {@link #release(Object)} instead, unless you absolutely need to swallow an exception.

safeRelease
void safeRelease(Object msg, int decrement)

Try to call {@link ReferenceCounted#release(int)} if the specified message implements {@link ReferenceCounted}. If the specified message doesn't implement {@link ReferenceCounted}, this method does nothing. Unlike {@link #release(Object)} this method catches an exception raised by {@link ReferenceCounted#release(int)} and logs it, rather than rethrowing it to the caller. It is usually recommended to use {@link #release(Object, int)} instead, unless you absolutely need to swallow an exception.

Meta