Detecting SDS Role Changes

You can call the System class getDatabaseRole or getDatabaseSubrole method to obtain the current database role or subrole for the JADE system in which it is executing or you can register for a system notification that indicates a role change has taken place.

The role change event is caused on the system instance when a database role change has completed. The eventType for this event is defined by the SDS_RoleChangeEvent global constant in the SDSEventTypes category. The userInfo parameter contains a value representing the role (that is, the SDS_RolePrimary, SDS_RoleSecondary, SDS_SubroleNative, or SDS_SubroleRelational global constant value in the SDSDatabaseRoles category).

The role change progress event is caused to notify applications about significant state changes that occur during a takeover operation.

The eventType of the role change progress event is defined by the SDS_RoleChangeProgress global constant in the SDSEventTypes category.

The userInfo parameter in a role change progress event contains a value representing the internal state, which can be one of the following SDSDatabaseRoles or SDSTakeoverState category global constants.

When a hostile takeover occurs, the userInfo parameter on an SDS secondary contains SDS_HostileTakeoverInitiated (4). When a negotiated takeover occurs, the userInfo parameter contains SDS_TakeoverInitiated (3) for all servers involved in the takeover.