public class ReplicationDbEnv extends Object
Constructor and Description |
---|
ReplicationDbEnv(String path,
ReplicationServer replicationServer)
Initialize this class.
|
Modifier and Type | Method and Description |
---|---|
com.sleepycat.je.Transaction |
beginTransaction()
Creates a new transaction.
|
void |
clearDb(com.sleepycat.je.Database db)
Clears the database.
|
void |
clearGenerationId(DN baseDN)
Clears the provided generationId associated to the provided baseDN from the
state Db.
|
void |
clearServerId(DN baseDN,
int serverId)
Clears the provided serverId associated to the provided baseDN from the
state Db.
|
ChangelogState |
getChangelogState()
Return the current changelog state.
|
com.sleepycat.je.Database |
getOrAddReplicationDB(int serverId,
DN baseDN,
long generationId)
Finds or creates the database used to store changes for a replica with the
given baseDN and serverId.
|
com.sleepycat.je.Database |
getOrCreateCNIndexDB()
Get or create a db to manage integer change number associated
to multidomain server state.
|
void |
notifyReplicaOffline(DN baseDN,
CSN offlineCSN)
Notify that replica is offline.
|
void |
notifyReplicaOnline(DN baseDN,
int serverId)
Notify that replica is online.
|
protected com.sleepycat.je.Database |
openDatabase(String databaseName)
Open a JE database.
|
protected com.sleepycat.je.Environment |
openJEEnvironment(String path)
Open a JE environment.
|
protected ChangelogState |
readOnDiskChangelogState()
Read and return the changelog state from the database.
|
void |
shutdown()
Shutdown the Db environment.
|
public ReplicationDbEnv(String path, ReplicationServer replicationServer) throws ChangelogException
path
- Path where the backing files must be created.replicationServer
- the ReplicationServer that creates this
ReplicationDbEnv.ChangelogException
- If an Exception occurred that prevented
the initialization to happen.protected com.sleepycat.je.Environment openJEEnvironment(String path)
protected so it can be overridden by tests.
path
- the path to the JE environment in the filesystemprotected com.sleepycat.je.Database openDatabase(String databaseName) throws ChangelogException, RuntimeException
protected so it can be overridden by tests.
databaseName
- the databaseName to openChangelogException
- if a problem happened opening the databaseRuntimeException
- if a problem happened with the JE databasepublic ChangelogState getChangelogState()
ChangelogState
protected ChangelogState readOnDiskChangelogState() throws ChangelogException
ChangelogState
read from the changelogState DBChangelogException
- if a database problem occurspublic com.sleepycat.je.Database getOrAddReplicationDB(int serverId, DN baseDN, long generationId) throws ChangelogException
serverId
- The server id that identifies the server.baseDN
- The baseDN that identifies the domain.generationId
- The generationId associated to this domain.ChangelogException
- in case of underlying Exception.public com.sleepycat.je.Transaction beginTransaction() throws ChangelogException
ChangelogException
- in case of underlying exceptionpublic void shutdown()
public void clearGenerationId(DN baseDN) throws ChangelogException
baseDN
- The baseDN for which the generationID must be cleared.ChangelogException
- If a database problem happenedpublic void clearServerId(DN baseDN, int serverId) throws ChangelogException
baseDN
- The baseDN for which the serverId must be cleared.serverId
- The serverId to remove from the Db.ChangelogException
- If a database problem happenedpublic void notifyReplicaOffline(DN baseDN, CSN offlineCSN) throws ChangelogException
This information is stored in the changelog state DB.
baseDN
- the domain of the offline replicaofflineCSN
- the offline replica serverId and offline timestampChangelogException
- if a database problem occurredpublic void notifyReplicaOnline(DN baseDN, int serverId) throws ChangelogException
Update the changelog state DB if necessary (ie, replica was known to be offline).
baseDN
- the domain of replicaserverId
- the serverId of replicaChangelogException
- if a database problem occurredpublic final void clearDb(com.sleepycat.je.Database db)
db
- The database to clear.public com.sleepycat.je.Database getOrCreateCNIndexDB() throws ChangelogException
ChangelogException
- when a problem occurs.Copyright © 2010-2015 ForgeRock AS. All Rights Reserved.