Class ASURLClassLoader.SentinelInputStream

  • All Implemented Interfaces:
    Closeable, AutoCloseable
    Enclosing class:
    ASURLClassLoader

    protected final class ASURLClassLoader.SentinelInputStream
    extends FilterInputStream
    Wraps all InputStreams returned by this class loader to report when a finalizer is run before the stream has been closed. This helps to identify where locked files could arise.
    Author:
    vtsyganok, tjquinn
    • Constructor Detail

      • SentinelInputStream

        protected SentinelInputStream​(InputStream in)
        Constructs new FilteredInputStream which reports InputStreams not closed properly. When the garbage collector runs the cleaner. If the stream is still open this class will report a stack trace showing where the stream was opened.
        Parameters:
        in - - InputStream to be wrapped
    • Method Detail

      • registerStopEvent

        public final void registerStopEvent()
        Callback invoked by Garbage Collector. If underlying InputStream was not closed properly, the stack trace of the constructor will be logged! 'closed' is 'volatile', but it's a race condition to check it and how this code relates to _close() is unclear.