Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*-
   * See the file LICENSE for redistribution information.
   *
   * Copyright (c) 2002, 2013 Oracle and/or its affiliates.  All rights reserved.
   *
   */
  
  package com.sleepycat.je;

Specifies the attributes of an application invoked preload operation.
 
 public class PreloadConfig implements Cloneable {
 
     private long maxBytes;
     private long maxMillisecs;
     private boolean loadLNs;
     private long lsnBatchSize = .;
     private long internalMemoryLimit = .;

    
Default configuration used if null is passed to Database.preload(long).
 
     public PreloadConfig() {
     }

    
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
 
     public PreloadConfig setMaxBytes(final long maxBytes) {
         setMaxBytesVoid(maxBytes);
         return this;
     }

    

Hidden:
The void return setter for use by Bean editors.
 
     public void setMaxBytesVoid(final long maxBytes) {
         this. = maxBytes;
     }

    
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.
 
     public long getMaxBytes() {
         return ;
     }

    
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
 
     public PreloadConfig setMaxMillisecs(final long maxMillisecs) {
         setMaxMillisecsVoid(maxMillisecs);
         return this;
     }

    

Hidden:
The void return setter for use by Bean editors.
 
     public void setMaxMillisecsVoid(final long maxMillisecs) {
         this. = maxMillisecs;
     }

    
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.
 
     public long getMaxMillisecs() {
         return ;
     }

    
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
    public PreloadConfig setLoadLNs(final boolean loadLNs) {
        setLoadLNsVoid(loadLNs);
        return this;
    }

    

Hidden:
The void return setter for use by Bean editors.
    public void setLoadLNsVoid(final boolean loadLNs) {
        this. = loadLNs;
    }

    
Return the configuration of the preload load LNs option.

Returns:
The configuration of the preload load LNs option.
    public boolean getLoadLNs() {
        return ;
    }

    
Preload progress listeners report this phase value, along with a count of the number if times that the preload has fetched from disk.
    public static enum Phases { 
        
Preload is in progress and resulted in a fetch from disk.
        PRELOAD };

    
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(java.lang.Enum,long,long) to avoid any unintended disruption to replication stream syncup.

Parameters:
progressListener The ProgressListener to callback during preload.
    public PreloadConfig
        setProgressListener(final ProgressListener<PhasesprogressListener) {
        setProgressListenerVoid(progressListener);
        return this;
    }

    

Hidden:
The void return setter for use by Bean editors.
    public void setProgressListenerVoid
        (final ProgressListener<PhasesprogressListener) {
        this. = progressListener;
    }

    
Return the ProgressListener for this PreloadConfig.

Returns:
the ProgressListener for this PreloadConfig.
        return ;
    }

    
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
    public PreloadConfig setLSNBatchSize(final long lsnBatchSize) {
        setLSNBatchSizeVoid(lsnBatchSize);
        return this;
    }

    

Hidden:
The void return setter for use by Bean editors.
    public void setLSNBatchSizeVoid(final long lsnBatchSize) {
        this. = lsnBatchSize;
    }

    
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.
    public long getLSNBatchSize() {
        return ;
    }

    
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
    public PreloadConfig
        setInternalMemoryLimit(final long internalMemoryLimit) {
        setInternalMemoryLimitVoid(internalMemoryLimit);
        return this;
    }

    

Hidden:
The void return setter for use by Bean editors.
    public void setInternalMemoryLimitVoid(final long internalMemoryLimit) {
        this. = internalMemoryLimit;
    }

    
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.
    public long getInternalMemoryLimit() {
        return ;
    }

    
Returns a copy of this configuration object.
    @Override
    public PreloadConfig clone() {
        try {
            return (PreloadConfigsuper.clone();
        } catch (CloneNotSupportedException willNeverOccur) {
            return null;
        }
    }

    
Returns the values for each configuration attribute.

Returns:
the values for each configuration attribute.
    @Override
    public String toString() {
        return "maxBytes=" +  +
            "\nmaxMillisecs=" +  +
            "\nloadLNs=" +  +
            "\nlsnBatchSize=" +  +
            "\ninternalMemoryLimit=" +  +
            "\n";
    }
New to GrepCode? Check out our FAQ X