public void shutdown() { LOG.info("Shutting down"); nextProcessor.shutdown(); syncProcessor.shutdown(); }
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(); }
si = queuedRequests.poll(); if (si == null) { flush(toFlush); continue; flush(toFlush); handleException(this.getName(), t); } finally{ running = false;
public void shutdown() { LOG.info("Shutting down"); queuedRequests.add(requestOfDeath); try { if(running){ this.join(); } if (!toFlush.isEmpty()) { flush(toFlush); } } catch(InterruptedException e) { LOG.warn("Interrupted while wating for " + this + " to finish"); } catch (IOException e) { LOG.warn("Got IO exception during shutdown"); } catch (RequestProcessorException e) { LOG.warn("Got request processor exception during shutdown"); } if (nextProcessor != null) { nextProcessor.shutdown(); } }
setRandRoll(r.nextInt(snapCount/2)); while (true) { Request si = null; si = queuedRequests.poll(); if (si == null) { flush(toFlush); continue; logCount++; if (logCount > (snapCount / 2 + randRoll)) { setRandRoll(r.nextInt(snapCount/2)); flush(toFlush); handleException(this.getName(), t); running = false;
/** * Unlike a Follower, which sees a full request only during the PROPOSAL * phase, Observers get all the data required with the INFORM packet. * This method commits a request that has been unpacked by from an INFORM * received from the Leader. * * @param request */ public void commitRequest(Request request) { if (syncRequestProcessorEnabled) { // Write to txnlog and take periodic snapshot syncProcessor.processRequest(request); } commitProcessor.commit(request); }
public ProposalRequestProcessor(LeaderZooKeeperServer zks, RequestProcessor nextProcessor) { this.zks = zks; this.nextProcessor = nextProcessor; AckRequestProcessor ackProcessor = new AckRequestProcessor(zks.getLeader()); syncProcessor = new SyncRequestProcessor(zks, ackProcessor); }
/** * initialize this processor */ public void initialize() { syncProcessor.start(); }
public void shutdown() { queuedRequests.add(requestOfDeath); try { this.join(); } catch(InterruptedException e) { LOG.warn("Interrupted while wating for " + this + " to finish"); } nextProcessor.shutdown(); }
/** * Unlike a Follower, which sees a full request only during the PROPOSAL * phase, Observers get all the data required with the INFORM packet. * This method commits a request that has been unpacked by from an INFORM * received from the Leader. * * @param request */ public void commitRequest(Request request) { if (syncRequestProcessorEnabled) { // Write to txnlog and take periodic snapshot syncProcessor.processRequest(request); } commitProcessor.commit(request); }
public void shutdown() { LOG.info("Shutting down"); queuedRequests.add(requestOfDeath); try { if(running){ this.join(); } if (!toFlush.isEmpty()) { flush(toFlush); } } catch(InterruptedException e) { LOG.warn("Interrupted while wating for " + this + " to finish"); } catch (IOException e) { LOG.warn("Got IO exception during shutdown"); } catch (RequestProcessorException e) { LOG.warn("Got request processor exception during shutdown"); } if (nextProcessor != null) { nextProcessor.shutdown(); } }
public ProposalRequestProcessor(LeaderZooKeeperServer zks, RequestProcessor nextProcessor) { this.zks = zks; this.nextProcessor = nextProcessor; AckRequestProcessor ackProcessor = new AckRequestProcessor(zks.getLeader()); syncProcessor = new SyncRequestProcessor(zks, ackProcessor); }
/** * initialize this processor */ public void initialize() { syncProcessor.start(); }
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(); }
@Override public synchronized void shutdown() { if (!canShutdown()) { LOG.debug("ZooKeeper server is not running, so not proceeding to shutdown!"); return; } super.shutdown(); if (syncRequestProcessorEnabled && syncProcessor != null) { syncProcessor.shutdown(); } } }
public void logRequest(TxnHeader hdr, Record txn) { Request request = new Request(hdr.getClientId(), hdr.getCxid(), hdr.getType(), hdr, txn, hdr.getZxid()); if ((request.zxid & 0xffffffffL) != 0) { pendingTxns.add(request); } syncProcessor.processRequest(request); }
public ProposalRequestProcessor(LeaderZooKeeperServer zks, RequestProcessor nextProcessor) { this.zks = zks; this.nextProcessor = nextProcessor; AckRequestProcessor ackProcessor = new AckRequestProcessor(zks.getLeader()); syncProcessor = new SyncRequestProcessor(zks, ackProcessor); }
/** * initialize this processor */ public void initialize() { syncProcessor.start(); }
@Override protected void setupRequestProcessors() { RequestProcessor finalProcessor = new FinalRequestProcessor(this); commitProcessor = new CommitProcessor(finalProcessor, Long.toString(getServerId()), true, getZooKeeperServerListener()); commitProcessor.start(); firstProcessor = new FollowerRequestProcessor(this, commitProcessor); ((FollowerRequestProcessor) firstProcessor).start(); syncProcessor = new SyncRequestProcessor(this, new SendAckRequestProcessor((Learner)getFollower())); syncProcessor.start(); }