Package org.kohsuke.file_leak_detector
Class Listener
- java.lang.Object
-
- org.kohsuke.file_leak_detector.Listener
-
public class Listener extends Object
Intercepted JDK calls land here.- Author:
- Kohsuke Kawaguchi
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Listener.FileRecord
Record of opened file.static class
Listener.Record
Remembers who/where/when opened a file.static class
Listener.SelectorRecord
static class
Listener.ServerSocketRecord
Record of opened server socket.static class
Listener.SinkChannelRecord
static class
Listener.SocketChannelRecord
Record of opened SocketChannel.static class
Listener.SocketRecord
Record of opened socket.static class
Listener.SourceChannelRecord
-
Field Summary
Fields Modifier and Type Field Description static PrintWriter
ERROR
Trace the "too many open files" error herestatic List<String>
EXCLUDES
Allows to provide stacktrace-lines which cause the element to be excludedstatic int
THRESHOLD
If the table size grows beyond this, report the tablestatic PrintWriter
TRACE
Trace the open/close op
-
Constructor Summary
Constructors Constructor Description Listener()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
close(Object _this)
Called when a file is closed.static void
dump(OutputStream out)
Dumps all files that are currently open.static void
dump(Writer w)
static List<Listener.Record>
getCurrentOpenFiles()
static boolean
isAgentInstalled()
Returns true if the leak detector agent is running.static void
makeStrong()
static void
open(Object _this, File f)
Called when a new file is opened.static void
openDirectoryStream(DirectoryStream<?> directoryStream, Path path)
static void
openFileChannel(FileChannel fileChannel, Path path)
static void
openFileChannel(SeekableByteChannel byteChannel, Path path)
static void
openPipe(Object _this)
static void
openSelector(Object _this)
static void
openSocket(Object _this)
Called when a socket is opened.static void
outOfDescriptors()
Called when the system has too many open files.
-
-
-
Field Detail
-
TRACE
public static PrintWriter TRACE
Trace the open/close op
-
ERROR
public static PrintWriter ERROR
Trace the "too many open files" error here
-
EXCLUDES
public static final List<String> EXCLUDES
Allows to provide stacktrace-lines which cause the element to be excluded
-
THRESHOLD
public static int THRESHOLD
If the table size grows beyond this, report the table
-
-
Method Detail
-
isAgentInstalled
public static boolean isAgentInstalled()
Returns true if the leak detector agent is running.
-
makeStrong
public static void makeStrong()
-
open
public static void open(Object _this, File f)
Called when a new file is opened.- Parameters:
_this
-FileInputStream
,FileOutputStream
,RandomAccessFile
, orZipFile
.f
- File being opened.
-
openPipe
public static void openPipe(Object _this)
-
openFileChannel
public static void openFileChannel(FileChannel fileChannel, Path path)
-
openFileChannel
public static void openFileChannel(SeekableByteChannel byteChannel, Path path)
-
openDirectoryStream
public static void openDirectoryStream(DirectoryStream<?> directoryStream, Path path)
-
openSelector
public static void openSelector(Object _this)
-
openSocket
public static void openSocket(Object _this)
Called when a socket is opened.
-
getCurrentOpenFiles
public static List<Listener.Record> getCurrentOpenFiles()
-
close
public static void close(Object _this)
Called when a file is closed. This method tolerates a double-close where a close method is called on an already closed object.- Parameters:
_this
-FileInputStream
,FileOutputStream
,RandomAccessFile
,Socket
,ServerSocket
, orZipFile
.
-
dump
public static void dump(OutputStream out)
Dumps all files that are currently open.
-
dump
public static void dump(Writer w)
-
outOfDescriptors
public static void outOfDescriptors()
Called when the system has too many open files.
-
-