|
Berkeley DB Java Edition version 4.0.117 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sleepycat.je.rep.CommitPointConsistencyPolicy
public class CommitPointConsistencyPolicy
A consistency policy which ensures that the environment on a Replica node is
at least as current as denoted by the specified CommitToken. This
token represents a point in the serialized transaction schedule created by
the master. In other words, this token is like a bookmark, representing a
particular transaction commit in the replication stream. The Replica ensures
that the commit identified by the CommitToken has been executed on
this node before allowing the application's Environment.beginTransaction()
operation on the Replica to proceed.
For example, suppose the application is a web application where a replicated group is implemented within a load balanced web server group. Each request to the web server consists of an update operation followed by read operations (say from the same client), The read operations naturally expect to see the data from the updates executed by the same request. However, the read operations might have been routed to a node that did not execute the update.
In such a case, the update request would generate a CommitToken,
which would be resubmitted by the browser, along with subsequent read
requests. The read request could be directed at any one of the available web
servers by a load balancer. The node which executes the read request would
create a CommitPointConsistencyPolicy with that CommitToken and use
it at transaction begin. If the environment at the web server was already
current (wrt the commit token), it could immediately execute the transaction
and satisfy the request. If not, the "transaction begin" would stall until
the Replica replay had caught up and the change was available at that web
server.
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)
CommitToken,
Managing Consistency| Field Summary | |
|---|---|
static String |
NAME
The name:"CommitPointConsistencyPolicy" associated with this policy. |
| Constructor Summary | |
|---|---|
CommitPointConsistencyPolicy(CommitToken commitToken,
long timeout,
TimeUnit timeoutUnit)
Defines how current a Replica needs to be in terms of a specific transaction that was committed on the Master. |
|
| Method Summary | |
|---|---|
boolean |
equals(Object obj)
|
CommitToken |
getCommitToken()
Return the CommitToken used to create this consistency
policy. |
String |
getName()
Returns the name:"CommitPointConsistencyPolicy", associated with this policy. |
long |
getTimeout(TimeUnit unit)
Return the timeout specified when creating this consistency policy. |
int |
hashCode()
|
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String NAME
| Constructor Detail |
|---|
public CommitPointConsistencyPolicy(CommitToken commitToken,
long timeout,
TimeUnit timeoutUnit)
commitToken has
been committed on the Replica. The Environment.beginTransaction() will wait for at most
timeout for the Replica to catch up. If the Replica has
not caught up in this period, the beginTransaction()
method will throw a ReplicaConsistencyException.
commitToken - the token identifying the transactiontimeout - the maximum amount of time that the transaction start
will wait to allow the Replica to catch up.timeoutUnit - the TimeUnit for the timeout parameter.
IllegalArgumentException - if the commitToken or timeoutUnit is
null.| Method Detail |
|---|
public String getName()
getName in interface ReplicaConsistencyPolicyNAMEpublic CommitToken getCommitToken()
CommitToken used to create this consistency
policy.
CommitToken used to create this consistency
policy.public long getTimeout(TimeUnit unit)
getTimeout in interface ReplicaConsistencyPolicyunit - the TimeUnit of the returned value.
public int hashCode()
hashCode in class ObjectObject.hashCode()public boolean equals(Object obj)
equals in class ObjectObject.equals(java.lang.Object)public String toString()
toString in class Object
|
Berkeley DB Java Edition version 4.0.117 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||