Berkeley DB: DbEnv::set_event_notify
Description: Berkeley DB: An embedded database programmatic toolkit.
Keywords: embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++

### DbEnv::set_event_notify |

`

###

    #include <db_cxx.h>

    int
    DbEnv::set_event_notify(void (*db_event_fcn)(DB_ENV *dbenv, u_int32_t event, void *event_info));

### Description: DbEnv::set_event_notify

The DbEnv::set_event_notify method configures a callback function which is called to notify the process of specific Berkeley DB events.

The DbEnv::set_event_notify method configures operations performed using the specified DbEnv handle, not all operations performed on the underlying database environment.

The DbEnv::set_event_notify method may be called at any time during the life of the application.

The DbEnv::set_event_notify method either returns a non-zero error value or throws an exception that encapsulates a non-zero error value on failure, and returns 0 on success.

### Parameters

db_event_fcn
  The db_event_fcn parameter is the application's event notification function. The function takes three parameters:
  dbenv
    The dbenv parameter is the enclosing database environment handle.
  event
    The event parameter is one of the following values:
    DB_EVENT_PANIC
      Errors can occur in the Berkeley DB library where the only solution is to shut down the application and run recovery (for example, if Berkeley DB is unable to allocate heap memory). In such cases, the Berkeley DB methods will either return DB_RUNRECOVERY or throw a DbRunRecoveryException, depending on the API configuration. It is often easier to simply exit the application when such errors occur rather than gracefully return up the stack.

      When event is set to DB_EVENT_PANIC, the database environment has failed. All threads of control in the database environment should exit the environment, and recovery should be run.

    DB_EVENT_REP_CLIENT
      The local site is now a replication client.
    DB_EVENT_REP_MASTER
      The local site is now the master site of its replication group. It is the application's responsibility to begin acting as the master environment.
    DB_EVENT_REP_NEWMASTER
      The replication group of which this site is a member has just established a new master; the local site is not the new master. The event_info parameter points to an integer containing the environment ID of the new master.

      The DB_EVENT_REP_NEWMASTER event is provided only to applications using the replication manager support.

    DB_EVENT_REP_STARTUPDONE
      The client has completed startup synchronization and is now processing live log records received from the master.
    DB_EVENT_WRITE_FAILED
      A Berkeley DB write to stable storage failed.

    Berkeley DB is not re-entrant. Callback functions should not attempt to make library calls (for example, to release locks or close open handles). Re-entering Berkeley DB is not guaranteed to work correctly, and the results are undefined.

  event_info
    The event_info parameter may reference memory which contains additional information describing an event. By default, event_info is NULL; specific events may pass non-NULL values, in which case the event will also describe the memory's structure.

### Class

DbEnv

### See Also

Database Environments and Related Methods`

Copyright (c) 1996-2006 Oracle Corporation - All rights reserved.