org.kohsuke.file_leak_detector
Class Listener

java.lang.Object
  extended by org.kohsuke.file_leak_detector.Listener

public class Listener
extends Object

Intercepted JDK calls land here.

Author:
Kohsuke Kawaguchi

Nested Class Summary
static class Listener.FileRecord
          Record of opened file.
static class Listener.Record
          Remembers who/where/when opened a file.
static class Listener.ServerSocketRecord
          Record of opened server socket.
static class Listener.SocketChannelRecord
          Record of opened SocketChannel.
static class Listener.SocketRecord
          Record of opened socket.
 
Field Summary
static PrintWriter ERROR
          Trace the "too many open files" error here
static List<String> EXCLUDES
          Allows to provide stacktrace-lines which cause the element to be excluded
static int THRESHOLD
          If the table size grows beyond this, report the table
static PrintWriter TRACE
          Trace the open/close op
 
Constructor Summary
Listener()
           
 
Method Summary
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 openSocket(Object _this)
          Called when a socket is opened.
static void outOfDescriptors()
          Called when the system has too many open files.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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

Constructor Detail

Listener

public Listener()
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, or ZipFile.
f - File being opened.

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, or ZipFile.

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.



Copyright © 2014. All rights reserved.