Skip to content

Commit

Permalink
ZOOKEEPER-1255 unused fields in DataTree.ProcessTxnResult
Browse files Browse the repository at this point in the history
Change-Id: I2f03a7cad0947b23fb261ef50ff98152f19275b2
  • Loading branch information
thkoch2001 committed Nov 1, 2011
1 parent 60abef3 commit f752f55
Showing 1 changed file with 7 additions and 39 deletions.
46 changes: 7 additions & 39 deletions src/java/main/org/apache/zookeeper/server/DataTree.java
Original file line number Diff line number Diff line change
Expand Up @@ -670,13 +670,7 @@ public AccessControlList getACL(String path, Stat stat)
}
}

static public class ProcessTxnResult {
public long clientId;

public int cxid;

public long zxid;

static public final class ProcessTxnResult {
public int err;

public OpCode type;
Expand All @@ -687,45 +681,19 @@ static public class ProcessTxnResult {

public List<ProcessTxnResult> multiResult;

/**
* Equality is defined as the clientId and the cxid being the same. This
* allows us to use hash tables to track completion of transactions.
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object o) {
if (o instanceof ProcessTxnResult) {
ProcessTxnResult other = (ProcessTxnResult) o;
return other.clientId == clientId && other.cxid == cxid;
}
return false;
}

/**
* See equals() to find the rational for how this hashcode is generated.
*
* @see ProcessTxnResult#equals(Object)
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
return (int) ((clientId ^ cxid) % Integer.MAX_VALUE);
}

// make sure this class is only instantiated from inside DataTree
private ProcessTxnResult(){}
}

public volatile long lastProcessedZxid = 0;

public ProcessTxnResult processTxn(TxnHeader header, Record txn)
{
ProcessTxnResult rc = new ProcessTxnResult();
final ProcessTxnResult rc = new ProcessTxnResult();

String debug = "";
final long zxid = header.getZxid();
try {
rc.clientId = header.getClientId();
rc.cxid = header.getCxid();
rc.zxid = header.getZxid();
rc.type = OpCode.fromInt(header.getType());
rc.err = 0;
rc.multiResult = null;
Expand Down Expand Up @@ -846,8 +814,8 @@ record = new ErrorTxn(ec);
* case where the snapshot contains data ahead of the zxid associated
* with the file.
*/
if (rc.zxid > lastProcessedZxid) {
lastProcessedZxid = rc.zxid;
if (zxid > lastProcessedZxid) {
lastProcessedZxid = zxid;
}
return rc;
}
Expand Down

0 comments on commit f752f55

Please sign in to comment.