PreloadConfig (Oracle - Berkeley DB Java Edition API)
Date: 2014-12-16

com.sleepycat.je

## Class PreloadConfig

- java.lang.Object
- - com.sleepycat.je.PreloadConfig

- All Implemented Interfaces:
    Cloneable

      public class PreloadConfig
      extends Object
      implements Cloneable

  Specifies the attributes of an application invoked preload operation.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `PreloadConfig.Phases` Preload progress listeners report this phase value, along with a count of the number if times that the preload has fetched from disk.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PreloadConfig()` Default configuration used if null is passed to `Database.preload`.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `PreloadConfig` | `clone()` Returns a copy of this configuration object.
    `long` | `getInternalMemoryLimit()` Returns the maximum amount of non JE Cache Memory that preload can use at one time.
    `boolean` | `getLoadLNs()` Return the configuration of the preload load LNs option.
    `long` | `getLSNBatchSize()` Preload is implemented to optimize I/O cost by fetching the records of a Database by disk order, so that disk access is are sequential rather than random.
    `long` | `getMaxBytes()` Return the number of bytes in the cache to stop the preload at.
    `long` | `getMaxMillisecs()` Return the number of millisecs to stop the preload after.
    `ProgressListener<PreloadConfig.Phases>` | `getProgressListener()` Return the ProgressListener for this PreloadConfig.
    `PreloadConfig` | `setInternalMemoryLimit(long internalMemoryLimit)` Set the maximum amount of non JE Cache Memory that preload can use at one time.
    `PreloadConfig` | `setLoadLNs(boolean loadLNs)` Configure the preload load LNs option.
    `PreloadConfig` | `setLSNBatchSize(long lsnBatchSize)` Set the maximum number of LSNs to gather and sort at any one time.
    `PreloadConfig` | `setMaxBytes(long maxBytes)` Configure the maximum number of bytes to preload.
    `PreloadConfig` | `setMaxMillisecs(long maxMillisecs)` Configure the maximum number of milliseconds to execute preload.
    `PreloadConfig` | `setProgressListener(ProgressListener<PreloadConfig.Phases> progressListener)` Configure the preload operation to make periodic calls to a `ProgressListener` to provide feedback on preload progress.
    `String` | `toString()` Returns the values for each configuration attribute.

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### PreloadConfig

          public PreloadConfig()

      Default configuration used if null is passed to `Database.preload`.

  - ### Method Detail

    - #### setMaxBytes

          public PreloadConfig setMaxBytes(long maxBytes)

      Configure the maximum number of bytes to preload.

      The default is 0 for this class.

      Parameters:
        `maxBytes` - If the maxBytes parameter is non-zero, a preload will stop when the cache contains this number of bytes.
      Returns:
        this

    - #### getMaxBytes

          public long getMaxBytes()

      Return the number of bytes in the cache to stop the preload at.

      This method may be called at any time during the life of the application.

      Returns:
        The number of bytes in the cache to stop the preload at.

    - #### setMaxMillisecs

          public PreloadConfig setMaxMillisecs(long maxMillisecs)

      Configure the maximum number of milliseconds to execute preload.

      The default is 0 for this class.

      Parameters:
        `maxMillisecs` - If the maxMillisecs parameter is non-zero, a preload will stop when this amount of time has passed.
      Returns:
        this

    - #### getMaxMillisecs

          public long getMaxMillisecs()

      Return the number of millisecs to stop the preload after.

      This method may be called at any time during the life of the application.

      Returns:
        The number of millisecs to stop the preload after.

    - #### setLoadLNs

          public PreloadConfig setLoadLNs(boolean loadLNs)

      Configure the preload load LNs option.

      The default is false for this class.

      Parameters:
        `loadLNs` - If set to true, the preload will load Leaf Nodes (LNs) containing the data values.
      Returns:
        this

    - #### getLoadLNs

          public boolean getLoadLNs()

      Return the configuration of the preload load LNs option.
      Returns:
        The configuration of the preload load LNs option.

    - #### setProgressListener

          public PreloadConfig setProgressListener(ProgressListener<PreloadConfig.Phases> progressListener)

      Configure the preload operation to make periodic calls to a `ProgressListener` to provide feedback on preload progress. The ProgressListener.progress() method is called each time the preload mush fetch a btree node or data record from disk.

      When using progress listeners, review the information at `ProgressListener.progress(T, long, long)` to avoid any unintended disruption to replication stream syncup.

      Parameters:
        `progressListener` - The ProgressListener to callback during preload.

    - #### getProgressListener

          public ProgressListener<PreloadConfig.Phases> getProgressListener()

      Return the ProgressListener for this PreloadConfig.
      Returns:
        the ProgressListener for this PreloadConfig.

    - #### setLSNBatchSize

          public PreloadConfig setLSNBatchSize(long lsnBatchSize)

      Set the maximum number of LSNs to gather and sort at any one time. The default is an unlimited number of LSNs. Setting this lower causes the preload to use less memory, but it sorts and processes LSNs more frequently thereby causing slower performance. Setting this higher will in general improve performance at the expense of memory. Each LSN uses 16 bytes of memory.
      Parameters:
        `lsnBatchSize` - the maximum number of LSNs to accumulate and sort per batch.
      Returns:
        this

    - #### getLSNBatchSize

          public long getLSNBatchSize()

      Preload is implemented to optimize I/O cost by fetching the records of a Database by disk order, so that disk access is are sequential rather than random. LSNs (log sequence numbers) are the disk addresses of database records. Setting this value causes the preload to process batches of LSNs rather than all in-memory LSNs at one time, which bounds the memory usage of the preload processing, at the expense of preload performance.
      Returns:
        the maximum number of LSNs to be sorted that this preload is configured for.

    - #### setInternalMemoryLimit

          public PreloadConfig setInternalMemoryLimit(long internalMemoryLimit)

      Set the maximum amount of non JE Cache Memory that preload can use at one time. The default is an unlimited amount of memory. Setting this lower causes the preload to use less memory, but generally results in slower performance. Setting this higher will often improve performance at the expense of higher memory utilization.
      Parameters:
        `internalMemoryLimit` - the maximum number of non JE Cache bytes to use.
      Returns:
        this

    - #### getInternalMemoryLimit

          public long getInternalMemoryLimit()

      Returns the maximum amount of non JE Cache Memory that preload can use at one time.
      Returns:
        the maximum amount of non JE Cache Memory that preload can use at one time.

    - #### clone

          public PreloadConfig clone()

      Returns a copy of this configuration object.
      Overrides:
        `clone` in class `Object`

    - #### toString

          public String toString()

      Returns the values for each configuration attribute.
      Overrides:
        `toString` in class `Object`
      Returns:
        the values for each configuration attribute.

Copyright (c) 2004, 2014 Oracle and/or its affiliates. All rights reserved.