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

com.sleepycat.je

## Interface ProgressListener<T extends Enum<T>>

-     public interface ProgressListener<T extends Enum<T>>

  ProgressListener provides feedback to the application that progress is being made on a potentially long running or asynchronous JE operation. The listener itself is general and abstract, and more details about the meaning of the progress callback can be found by reading about the entry points where specific ProgressListeners can be specified. For example, see:
  - `PreloadConfig.setProgressListener(com.sleepycat.je.ProgressListener<com.sleepycat.je.PreloadConfig.Phases>)`, which accepts a ProgressListener<PreloadConfig.Phase>, and reports on Environment.preload() or Database.preload()
  - `EnvironmentConfig.setRecoveryProgressListener(com.sleepycat.je.ProgressListener<com.sleepycat.je.RecoveryProgress>)`, which accepts a ProgressListener<RecoveryProgress>, and reports on environment startup.
  - `ReplicationConfig.setSyncupProgressListener(com.sleepycat.je.ProgressListener<com.sleepycat.je.rep.SyncupProgress>)`, which accepts a ProgressListener<SyncupProgress>, and reports on replication stream syncup.
  Since:
    5.0

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `progress(T phase, long n, long total)` Called by BDB JE to indicate to the user that progress has been made on a potentially long running or asynchronous operation.

- - ### Method Detail

    - #### progress

          boolean progress(T phase,
                         long n,
                         long total)

      Called by BDB JE to indicate to the user that progress has been made on a potentially long running or asynchronous operation.

      This method should do the minimal amount of work, queuing any resource intensive operations for processing by another thread before returning to the caller, so that it does not unduly delay the target operation, which invokes this method.

      The applicaton should also be aware that the method has potential to disrupt the reported-upon operation. If the progress() throws a RuntimeException, the operation for which the progress is being reported will be aborted and the exception propagated back to the original caller. Also, if progress() returns false, the operation will be halted. For recovery and syncup listeners, a false return value can invalidate and close the environment.

      Parameters:
        `phase` - an enum indicating the phase of the operation for which progress is being reported.
        `n` - indicates the number of units that have been processed so far. If this does not apply, -1 is returned.
        `total` - indicates the total number of units that will be processed if it is known by JE. If total is < 0, then the total number is unknown. When total == n, this indicates that processing of this operation is 100% complete, even if all previous calls to progress passed a negative value for total.
      Returns:
        true to continue the operation, false to stop it.

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