Berkeley DB Java Edition
version 5.0.34

com.sleepycat.je.rep
Class TimeConsistencyPolicy

java.lang.Object
  extended by com.sleepycat.je.rep.TimeConsistencyPolicy
All Implemented Interfaces:
ReplicaConsistencyPolicy

public class TimeConsistencyPolicy
extends Object
implements ReplicaConsistencyPolicy

A consistency policy which describes the amount of time the Replica is allowed to lag the Master. The application can use this policy to ensure that this node sees all transactions that were committed on the Master before the lag interval.

Effective use of this policy requires that the clocks on the Master and Replica are synchronized by using a protocol like NTP

Consistency policies are specified at either a per-transaction level through TransactionConfig.setConsistencyPolicy(com.sleepycat.je.ReplicaConsistencyPolicy) or as an replication node wide default through ReplicationConfig.setConsistencyPolicy(com.sleepycat.je.ReplicaConsistencyPolicy)

See Also:
Managing Consistency

Field Summary
static String NAME
          The name:"TimeConsistencyPolicy" associated with this policy.
 
Constructor Summary
TimeConsistencyPolicy(long permissibleLag, TimeUnit permissibleLagUnit, long timeout, TimeUnit timeoutUnit)
          Specifies the amount of time by which the Replica is allowed to lag the master when initiating a transaction.
 
Method Summary
 boolean equals(Object obj)
           
 String getName()
          Returns the name:"TimeConsistencyPolicy", associated with this policy.
 long getPermissibleLag(TimeUnit unit)
          Returns the allowed time lag associated with this policy.
 long getTimeout(TimeUnit unit)
          Returns the consistency timeout associated with this policy.
 int hashCode()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NAME

public static final String NAME
The name:"TimeConsistencyPolicy" associated with this policy. The name can be used when constructing policy property values for use in je.properties files.

See Also:
Constant Field Values
Constructor Detail

TimeConsistencyPolicy

public TimeConsistencyPolicy(long permissibleLag,
                             TimeUnit permissibleLagUnit,
                             long timeout,
                             TimeUnit timeoutUnit)
Specifies the amount of time by which the Replica is allowed to lag the master when initiating a transaction. The Replica ensures that all transactions that were committed on the Master before this lag interval are available at the Replica before allowing a transaction to proceed with Environment.beginTransaction. Effective use of this policy requires that the clocks on the Master and Replica are synchronized by using a protocol like NTP.

Parameters:
permissibleLag - the time interval by which the Replica may be out of date with respect to the Master when a transaction is initiated on the Replica.
permissibleLagUnit - the TimeUnit for the permissibleLag parameter.
timeout - the amount of time to wait for the consistency to be reached.
timeoutUnit - the TimeUnit for the timeout parameter.
Throws:
IllegalArgumentException - if the permissibleLagUnit or timeoutUnit is null.
Method Detail

getName

public String getName()
Returns the name:"TimeConsistencyPolicy", associated with this policy.

Specified by:
getName in interface ReplicaConsistencyPolicy
See Also:
NAME

getPermissibleLag

public long getPermissibleLag(TimeUnit unit)
Returns the allowed time lag associated with this policy.

Parameters:
unit - the TimeUnit of the returned value.
Returns:
the permissible lag time in the specified unit.

getTimeout

public long getTimeout(TimeUnit unit)
Returns the consistency timeout associated with this policy.

Specified by:
getTimeout in interface ReplicaConsistencyPolicy
Parameters:
unit - the TimeUnit of the returned value.
Returns:
the consistency timeout in the specified unit.

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object

Berkeley DB Java Edition
version 5.0.34

Copyright (c) 2004-2011 Oracle. All rights reserved.