Changeset 6100


Ignore:
Timestamp:
04/08/10 05:52:23 (10 years ago)
Author:
callan
Message:

Moved byte buffer map() vs. allocate() to a static block and the state notification to the INFO log level.

File:
1 edited

Legend:

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

    r6093 r6100  
    6262 
    6363  /** Whether or not we are to use memory mapped I/O. */ 
    64   private boolean useMappedByteBuffer = false; 
     64  private static boolean useMappedByteBuffer = false; 
    6565 
    6666  /** File channel to allocate or map data from. */ 
     
    7070  private MapMode mapMode; 
    7171 
    72   // -- Constructors -- 
    73  
    74   /** 
    75    * Default constructor. 
    76    * @param channel File channel to allocate or map byte buffers from. 
    77    * @param mapMode The map mode. Required but only used if memory mapped I/O 
    78    * is to occur. 
    79    */ 
    80   public NIOByteBufferProvider(FileChannel channel, MapMode mapMode) { 
    81     this.channel = channel; 
    82     this.mapMode = mapMode; 
     72  static { 
    8373    String osArch = System.getProperty("os.arch"); 
    8474    String javaVersion = System.getProperty("java.version"); 
     
    10696          useMappedByteBuffer = true; 
    10797        } 
     98        else { 
     99          useMappedByteBuffer = false; 
     100        } 
    108101      } 
    109102      catch (Exception e) { 
     
    111104      } 
    112105    } 
    113     LOGGER.debug("Using mapped byte buffer? " + useMappedByteBuffer); 
     106    LOGGER.info("Using mapped byte buffer? " + useMappedByteBuffer); 
     107  } 
     108 
     109  // -- Constructors -- 
     110 
     111  /** 
     112   * Default constructor. 
     113   * @param channel File channel to allocate or map byte buffers from. 
     114   * @param mapMode The map mode. Required but only used if memory mapped I/O 
     115   * is to occur. 
     116   */ 
     117  public NIOByteBufferProvider(FileChannel channel, MapMode mapMode) { 
     118    this.channel = channel; 
     119    this.mapMode = mapMode; 
    114120  } 
    115121 
Note: See TracChangeset for help on using the changeset viewer.