Package io.netty.util

Class ReferenceCountUtil


  • public final class ReferenceCountUtil
    extends java.lang.Object
    Collection of method to handle objects that may implement ReferenceCounted.
    • Method Detail

      • releaseLater

        @Deprecated
        public static <T> T releaseLater​(T msg)
        Deprecated.
        this may introduce a lot of memory usage so it is generally preferable to manually release objects.
        Schedules the specified object to be released when the caller thread terminates. Note that this operation is intended to simplify reference counting of ephemeral objects during unit tests. Do not use it beyond the intended use case.
      • releaseLater

        @Deprecated
        public static <T> T releaseLater​(T msg,
                                         int decrement)
        Deprecated.
        this may introduce a lot of memory usage so it is generally preferable to manually release objects.
        Schedules the specified object to be released when the caller thread terminates. Note that this operation is intended to simplify reference counting of ephemeral objects during unit tests. Do not use it beyond the intended use case.
      • refCnt

        public static int refCnt​(java.lang.Object msg)
        Returns reference count of a ReferenceCounted object. If object is not type of ReferenceCounted, -1 is returned.