zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ph...@apache.org
Subject svn commit: r1190073 - in /zookeeper/trunk: CHANGES.txt src/java/main/org/apache/zookeeper/server/PrepRequestProcessor.java
Date Thu, 27 Oct 2011 22:58:04 GMT
Author: phunt
Date: Thu Oct 27 22:58:03 2011
New Revision: 1190073

URL: http://svn.apache.org/viewvc?rev=1190073&view=rev
Log:
ZOOKEEPER-1247. dead code in PrepRequestProcessor.pRequest multi case (Thomas Koch via phunt)

Modified:
    zookeeper/trunk/CHANGES.txt
    zookeeper/trunk/src/java/main/org/apache/zookeeper/server/PrepRequestProcessor.java

Modified: zookeeper/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/trunk/CHANGES.txt?rev=1190073&r1=1190072&r2=1190073&view=diff
==============================================================================
--- zookeeper/trunk/CHANGES.txt (original)
+++ zookeeper/trunk/CHANGES.txt Thu Oct 27 22:58:03 2011
@@ -86,6 +86,9 @@ IMPROVEMENTS:
   ZOOKEEPER-1200. Remove obsolete DataTreeBuilder
   (Thomas Koch via phunt)
 
+  ZOOKEEPER-1247. dead code in PrepRequestProcessor.pRequest multi case
+  (Thomas Koch via phunt)
+
 Release 3.4.0 - 
 
 Non-backward compatible changes:

Modified: zookeeper/trunk/src/java/main/org/apache/zookeeper/server/PrepRequestProcessor.java
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/PrepRequestProcessor.java?rev=1190073&r1=1190072&r2=1190073&view=diff
==============================================================================
--- zookeeper/trunk/src/java/main/org/apache/zookeeper/server/PrepRequestProcessor.java (original)
+++ zookeeper/trunk/src/java/main/org/apache/zookeeper/server/PrepRequestProcessor.java Thu
Oct 27 22:58:03 2011
@@ -500,27 +500,29 @@ public class PrepRequestProcessor extend
                 Map<String, ChangeRecord> pendingChanges = getPendingChanges(multiRequest);
 
                 for(Op op: multiRequest) {
-                    Record subrequest = op.toRequestRecord() ;
+                    Record subrequest = op.toRequestRecord();
+                    int type;
+                    Record txn;
 
                     /* If we've already failed one of the ops, don't bother
                      * trying the rest as we know it's going to fail and it
                      * would be confusing in the logfiles.
                      */
                     if (ke != null) {
-                        request.getHdr().setType(OpCode.error);
-                        request.setTxn(new ErrorTxn(Code.RUNTIMEINCONSISTENCY.intValue()));
+                        type = OpCode.error;
+                        txn = new ErrorTxn(Code.RUNTIMEINCONSISTENCY.intValue());
                     }
 
                     /* Prep the request and convert to a Txn */
                     else {
                         try {
                             pRequest2Txn(op.getType(), zxid, request, subrequest);
+                            type = request.getHdr().getType();
+                            txn = request.getTxn();
                         } catch (KeeperException e) {
-                            if (ke == null) {
-                                ke = e;
-                            }
-                            request.getHdr().setType(OpCode.error);
-                            request.setTxn(new ErrorTxn(e.code().intValue()));
+                            ke = e;
+                            type = OpCode.error;
+                            txn = new ErrorTxn(e.code().intValue());
                             LOG.error(">>>> Got user-level KeeperException when
processing "
                                     + request.toString()
                                     + " Error Path:" + e.getPath()
@@ -538,10 +540,10 @@ public class PrepRequestProcessor extend
                     //       not sure how else to get the txn stored into our list.
                     ByteArrayOutputStream baos = new ByteArrayOutputStream();
                     BinaryOutputArchive boa = BinaryOutputArchive.getArchive(baos);
-                    request.getTxn().serialize(boa, "request") ;
+                    txn.serialize(boa, "request") ;
                     ByteBuffer bb = ByteBuffer.wrap(baos.toByteArray());
 
-                    txns.add(new Txn(request.getHdr().getType(), bb.array()));
+                    txns.add(new Txn(type, bb.array()));
                 }
 
                 request.setHdr(new TxnHeader(request.sessionId, request.cxid, zxid, zks.getTime(),
request.type));



Mime
View raw message