protected void initializeEventListeners() { for (AsyncEventListener listener : this.eventProcessor.getSender().getAsyncEventListeners()) { registerAsyncEventListener(listener); } }
protected void stopProcessing() { // Stop the dispatcher AbstractGatewaySenderEventProcessor ev = this.eventProcessor; if (ev != null && !ev.isStopped()) { ev.stopProcessing(); } if (ev != null && ev.getDispatcher() != null) { ev.getDispatcher().shutDownAckReaderConnection(); } }
/** * In case of BatchException we expect that the dispatcher has removed all the events till the * event that threw BatchException. */ public void handleException() { final GatewaySenderStats statistics = this.sender.getStatistics(); statistics.incBatchesRedistributed(); this.resetLastPeekedEvents = true; }
@Override public void stop() { stopAckReaderThread(); if (this.processor.isStopped()) { destroyConnection(); } }
public GatewaySenderEventRemoteDispatcher(AbstractGatewaySenderEventProcessor eventProcessor) { this.processor = eventProcessor; this.sender = eventProcessor.getSender(); // this.ackReaderThread = new AckReaderThread(sender); try { initializeConnection(); } catch (GatewaySenderException e) { // It is ok to ignore this exception. It is logged in the initializeConnection call. } }
public void setDispatcher() { AbstractGatewaySenderEventProcessor eventProcessor = abstractSender.getEventProcessor(); if (eventProcessor != null) { this.dispatcher = abstractSender.getEventProcessor().getDispatcher(); } }
public static void createAsyncEventQueue(String asyncChannelId, boolean isParallel, Integer maxMemory, Integer batchSize, boolean isConflation, boolean isPersistent, String diskStoreName, boolean isDiskSynchronous) { createAsyncEventQueue(asyncChannelId, isParallel, maxMemory, batchSize, isConflation, isPersistent, diskStoreName, isDiskSynchronous, new MyAsyncEventListener()); }
@Override public Socket accept() throws IOException { Socket s = new TransportFilterSocket(this.gatewayTransportFilters); implAccept(s); return s; } }
@Override public int size() { return sender.getEventProcessor().getTotalQueueSize(); }
@Override public boolean isPrimary() { return this.getSenderAdvisor().isPrimary(); }
@Override public Boolean call() { this.p.stopProcessing(); return true; } }
private GatewaySenderAdvisor(DistributionAdvisee sender) { super(sender); this.sender = (AbstractGatewaySender) sender; this.lockToken = getDLockServiceName() + "-token"; }
public static GatewaySenderAdvisor createGatewaySenderAdvisor(DistributionAdvisee sender) { GatewaySenderAdvisor advisor = new GatewaySenderAdvisor(sender); advisor.initialize(); return advisor; }
public void setIsPrimary(boolean isPrimary) { this.getSenderAdvisor().setIsPrimary(isPrimary); }
public void notifyAndBecomePrimary() { synchronized (this.primaryLock) { setIsPrimary(true); notifyPrimaryLock(); } }
public static void createAsyncEventQueue(String asyncChannelId, boolean isParallel, Integer maxMemory, Integer batchSize, boolean isConflation, boolean isPersistent, String diskStoreName, boolean isDiskSynchronous, final AsyncEventListener asyncEventListener) { createAsyncEventQueue(asyncChannelId, isParallel, maxMemory, batchSize, isConflation, isPersistent, diskStoreName, isDiskSynchronous, numDispatcherThreadsForTheRun, asyncEventListener); }
@Override public Object getValueToConflate() { // Since all the uses of this are for logging // changing it to return the string form of the value // instead of the actual value. return this.getValueAsString(true); }
/** * Initialize this instance. Get the useful parts of the input operation and event. */ public void initialize() { if (isInitialized()) { return; } this.isInitialized = true; }
public boolean isConnected() { if (this.dispatcher != null && this.dispatcher.isConnectedToRemote()) { return true; } else { return false; } }