use of org.apache.zookeeper.server.Request in project zookeeper by apache.
the class QuorumZooKeeperServer method upgrade.
/**
* Implements the SessionUpgrader interface,
*
* @param sessionId
*/
public void upgrade(long sessionId) {
Request request = makeUpgradeRequest(sessionId);
if (request != null) {
LOG.info("Upgrading session 0x{}", Long.toHexString(sessionId));
// This must be a global request
submitRequest(request);
}
}
use of org.apache.zookeeper.server.Request in project zookeeper by apache.
the class ObserverRequestProcessor method processRequest.
/**
* Simply queue the request, which will be processed in FIFO order.
*/
public void processRequest(Request request) {
if (!finished) {
Request upgradeRequest = null;
try {
upgradeRequest = zks.checkUpgradeSession(request);
} catch (KeeperException ke) {
if (request.getHdr() != null) {
request.getHdr().setType(OpCode.error);
request.setTxn(new ErrorTxn(ke.code().intValue()));
}
request.setException(ke);
LOG.info("Error creating upgrade request", ke);
} catch (IOException ie) {
LOG.error("Unexpected error in upgrade", ie);
}
if (upgradeRequest != null) {
queuedRequests.add(upgradeRequest);
}
queuedRequests.add(request);
}
}
use of org.apache.zookeeper.server.Request in project zookeeper by apache.
the class Slf4JAuditLoggerTest method getUser.
private String getUser() {
ServerCnxn next = getServerCnxn();
Request request = new Request(next, -1, -1, -1, null, next.getAuthInfo());
return request.getUsersForAudit();
}
use of org.apache.zookeeper.server.Request in project zookeeper by apache.
the class TruncateTest method append.
private void append(ZKDatabase zkdb, int i) throws IOException {
TxnHeader hdr = new TxnHeader(1, 1, i, 1, ZooDefs.OpCode.setData);
Record txn = new SetDataTxn("/foo" + i, new byte[0], 1);
Request req = new Request(0, 0, 0, hdr, txn, 0);
zkdb.append(req);
zkdb.commit();
}
use of org.apache.zookeeper.server.Request in project zookeeper by apache.
the class LeaderBeanTest method testGetProposalSize.
@Test
public void testGetProposalSize() throws IOException, Leader.XidRolloverException {
// Arrange
Request req = createMockRequest();
// Act
leader.propose(req);
// Assert
byte[] data = SerializeUtils.serializeRequest(req);
assertEquals(data.length, leaderBean.getLastProposalSize());
assertEquals(data.length, leaderBean.getMinProposalSize());
assertEquals(data.length, leaderBean.getMaxProposalSize());
}
Aggregations