Changeset 7230


Ignore:
Timestamp:
11/22/10 11:31:28 (9 years ago)
Author:
callan
Message:

File handle open/close logging at the TRACE level and a test case to pick that log message up and track the open/close semantics of a RandomAccessInputStream.

Location:
trunk/components
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/components/common/src/loci/common/RandomAccessInputStream.java

    r6881 r7230  
    3030import java.nio.ByteBuffer; 
    3131import java.nio.ByteOrder; 
     32 
     33import org.slf4j.Logger; 
     34import org.slf4j.LoggerFactory; 
    3235 
    3336/** 
     
    4750  protected static final int MAX_OVERHEAD = 1048576; 
    4851 
     52  /** Logger for this class. */ 
     53  private static final Logger LOGGER = 
     54    LoggerFactory.getLogger(RandomAccessInputStream.class); 
     55 
    4956  /** 
    5057   * Block size to use when searching through the stream. 
     
    7582  /** Constructs a random access stream around the given handle. */ 
    7683  public RandomAccessInputStream(IRandomAccess handle) throws IOException { 
     84    if (LOGGER.isTraceEnabled()) { 
     85      LOGGER.trace("RandomAccessInputStream {} OPEN", hashCode()); 
     86    } 
    7787    raf = handle; 
    7888    raf.setOrder(ByteOrder.BIG_ENDIAN); 
     
    104114  /** Closes the streams. */ 
    105115  public void close() throws IOException { 
     116    if (LOGGER.isTraceEnabled()) { 
     117      LOGGER.trace("RandomAccessInputStream {} CLOSE", hashCode()); 
     118    } 
    106119    if (Location.getMappedFile(file) != null) return; 
    107120    if (raf != null) raf.close(); 
Note: See TracChangeset for help on using the changeset viewer.