com.sun.enterprise.loader
Class ASURLClassLoader.SentinelInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by com.sun.enterprise.loader.ASURLClassLoader.SentinelInputStream
All Implemented Interfaces:
java.io.Closeable
Enclosing class:
ASURLClassLoader

protected final class ASURLClassLoader.SentinelInputStream
extends java.io.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

Field Summary
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
protected ASURLClassLoader.SentinelInputStream(java.io.InputStream in)
          Constructs new FilteredInputStream which reports InputStreams not closed properly.
 
Method Summary
 void close()
          Closes underlying input stream.
protected  void finalize()
          Invoked by Garbage Collector.
 
Methods inherited from class java.io.FilterInputStream
available, mark, markSupported, read, read, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ASURLClassLoader.SentinelInputStream

protected ASURLClassLoader.SentinelInputStream(java.io.InputStream in)
Constructs new FilteredInputStream which reports InputStreams not closed properly. When the garbage collector runs the finalizer. 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

close

public void close()
           throws java.io.IOException
Closes underlying input stream.

Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.FilterInputStream
Throws:
java.io.IOException

finalize

protected void finalize()
                 throws java.lang.Throwable
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.

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable


Copyright © 2012 GlassFish Community. All Rights Reserved.