/** * append the request to the transaction logs * @param si the request to be appended * returns true iff something appended, otw false * @throws IOException */ public boolean append(Request si) throws IOException { return txnLog.append(si.getHdr(), si.getTxn()); }
public ProcessTxnResult processTxn(Request request) { return processTxn(request, request.getHdr(), request.getTxn()); }
public static byte[] serializeRequest(Request request) { if (request == null || request.getHdr() == null) return null; ByteArrayOutputStream baos = new ByteArrayOutputStream(); BinaryOutputArchive boa = BinaryOutputArchive.getArchive(baos); try { request.getHdr().serialize(boa, "hdr"); if (request.getTxn() != null) { request.getTxn().serialize(boa, "txn"); } } catch (IOException e) { LOG.error("This really should be impossible", e); } finally { IOUtils.cleanup(LOG, baos); } return baos.toByteArray(); } }
topPending.setTxn(request.getTxn()); topPending.zxid = request.zxid; request = topPending;
@Test public void testPRequest() throws Exception { pLatch = new CountDownLatch(1); processor = new PrepRequestProcessor(zks, new MyRequestProcessor()); Request foo = new Request(null, 1l, 1, OpCode.create, ByteBuffer.allocate(3), null); processor.pRequest(foo); Assert.assertEquals("Request should have marshalling error", new ErrorTxn(KeeperException.Code.MARSHALLINGERROR.intValue()), outcome.getTxn()); Assert.assertTrue("request hasn't been processed in chain", pLatch.await(5, TimeUnit.SECONDS)); }
SetDataTxn setDataTxn = (SetDataTxn) request.getTxn(); QuorumVerifier qv = self.configFromString(new String(setDataTxn.getData()));
pRequest2Txn(op.getType(), zxid, request, subrequest, false); type = request.getHdr().getType(); txn = request.getTxn(); } catch (KeeperException e) { ke = e;
} else { throw KeeperException.create(KeeperException.Code .get(((ErrorTxn) request.getTxn()).getErr()));