protected void setupRequestProcessors() { RequestProcessor finalProcessor = new FinalRequestProcessor(this); RequestProcessor syncProcessor = new SyncRequestProcessor(this, finalProcessor); ((SyncRequestProcessor)syncProcessor).start(); firstProcessor = new PrepRequestProcessor(this, syncProcessor); ((PrepRequestProcessor)firstProcessor).start(); }
protected void packetReceived(long bytes) { incrPacketsReceived(); ServerStats serverStats = serverStats(); if (serverStats != null) { serverStats().incrementPacketsReceived(); } ServerMetrics.BYTES_RECEIVED_COUNT.add(bytes); }
private ContainerManager newContainerManager(final AtomicLong fakeElapsed) { return new ContainerManager(serverFactory.getZooKeeperServer() .getZKDatabase(), serverFactory.getZooKeeperServer().firstProcessor, 1, 100) { @Override protected long getElapsed(DataNode node) { return fakeElapsed.get(); } }; } }
public void resetStatistics() { ServerStats serverStats = zks.serverStats(); serverStats.resetRequestCounters(); serverStats.resetLatency(); serverStats.resetFsyncThresholdExceedCount(); }
public void startdata() throws IOException, InterruptedException { //check to see if zkDb is not null if (zkDb == null) { zkDb = new ZKDatabase(this.txnLogFactory); } if (!zkDb.isInitialized()) { loadData(); } }
@Override public void startup(ZooKeeperServer zks, boolean startServer) throws IOException, InterruptedException { start(); setZooKeeperServer(zks); if (startServer) { zks.startdata(); zks.startup(); } }
void touch(ServerCnxn cnxn) throws MissingSessionException { if (cnxn == null) { return; } long id = cnxn.getSessionId(); int to = cnxn.getSessionTimeout(); if (!sessionTracker.touchSession(id, to)) { throw new MissingSessionException( "No session with sessionid 0x" + Long.toHexString(id) + " exists, probably expired and removed"); } }
@Override public void startup(ZooKeeperServer zks, boolean startServer) throws IOException, InterruptedException { start(); setZooKeeperServer(zks); if (startServer) { zks.startdata(); zks.startup(); } }
private void updateStats(Request request, String lastOp, long lastZxid) { if (request.cnxn == null) { return; } long currentTime = Time.currentElapsedTime(); zks.serverStats().updateLatency(request, currentTime); request.cnxn.updateStatsForResponse(request.cxid, lastZxid, lastOp, request.createTime, currentTime); } }
private void close(long sessionId) { Request si = new Request(null, sessionId, 0, OpCode.closeSession, null, null); setLocalSessionFlag(si); submitRequest(si); }
protected void createSessionTracker() { sessionTracker = new SessionTrackerImpl(this, zkDb.getSessionWithTimeOuts(), tickTime, createSessionTrackerServerId, getZooKeeperServerListener()); }
protected void packetSent() { incrPacketsSent(); ServerStats serverStats = serverStats(); if (serverStats != null) { serverStats.incrementPacketsSent(); } }
/** * Creates a ZooKeeperServer instance. Nothing is setup, use the setX * methods to prepare the instance (eg datadir, datalogdir, ticktime, * builder, etc...) * * @throws IOException */ public ZooKeeperServer() { serverStats = new ServerStats(this); listener = new ZooKeeperServerListenerImpl(this); }
private QuorumZooKeeperServer getConnectedServer(long sessionId) { for (QuorumPeer peer : getPeerList()) { if (peer.getActiveServer().getSessionTracker().isTrackingSession(sessionId)) { return (QuorumZooKeeperServer)peer.getActiveServer(); } } return null; } }
/** * Add or update cnxn in our cnxnExpiryQueue * @param cnxn */ public void touchCnxn(NIOServerCnxn cnxn) { cnxnExpiryQueue.update(cnxn, cnxn.getSessionTimeout()); }
private void requestInterestOpsUpdate() { if (isSelectable()) { selectorThread.addInterestOpsUpdateRequest(sk); } }
public void setConnectionDecreaseRatio(double val) { zks.connThrottle().setDecreasePoint(val); } }
private void updateSessionExpiry(SessionImpl s, int timeout) { logTraceTouchSession(s.sessionId, timeout, ""); sessionExpiryQueue.update(s, timeout); }
private ContainerManager newContainerManager(final AtomicLong fakeElapsed) { return new ContainerManager(serverFactory.getZooKeeperServer() .getZKDatabase(), serverFactory.getZooKeeperServer().firstProcessor, 1, 100) { @Override protected long getElapsed(DataNode node) { return fakeElapsed.get(); } }; } }