@Override public GatewaySenderFactory addAsyncEventListener(AsyncEventListener listener) { this.attrs.addAsyncEventListener(listener); return this; }
@Override public AsyncEventQueueFactory addGatewayEventFilter(GatewayEventFilter filter) { gatewaySenderAttributes.addGatewayEventFilter(filter); return this; }
public AsyncEventQueueFactoryImpl(InternalCache cache) { this(cache, new GatewaySenderAttributes(), DEFAULT_BATCH_TIME_INTERVAL); }
public AbstractGatewaySender(InternalCache cache, GatewaySenderAttributes attrs) { this.cache = cache; this.id = attrs.getId(); this.socketBufferSize = attrs.getSocketBufferSize(); this.socketReadTimeout = attrs.getSocketReadTimeout(); this.queueMemory = attrs.getMaximumQueueMemory(); this.batchSize = attrs.getBatchSize(); this.batchTimeInterval = attrs.getBatchTimeInterval(); this.isConflation = attrs.isBatchConflationEnabled(); this.isPersistence = attrs.isPersistenceEnabled(); this.alertThreshold = attrs.getAlertThreshold(); this.manualStart = attrs.isManualStart(); this.isParallel = attrs.isParallel(); this.isForInternalUse = attrs.isForInternalUse(); this.diskStoreName = attrs.getDiskStoreName(); this.remoteDSId = attrs.getRemoteDSId(); this.eventFilters = attrs.getGatewayEventFilters(); this.transFilters = attrs.getGatewayTransportFilters(); this.listeners = attrs.getAsyncEventListeners(); this.substitutionFilter = attrs.getGatewayEventSubstitutionFilter(); this.locatorDiscoveryCallback = attrs.getGatewayLocatoDiscoveryCallback(); this.isDiskSynchronous = attrs.isDiskSynchronous(); this.policy = attrs.getOrderPolicy(); this.dispatcherThreads = attrs.getDispatcherThreads(); this.parallelismForReplicatedRegion = attrs.getParallelismForReplicatedRegion(); this.isMetaQueue = attrs.isMetaQueue(); if (!(this.cache instanceof CacheCreation)) { this.myDSId = this.cache.getInternalDistributedSystem().getDistributionManager()
if (this.attrs.getDispatcherThreads() <= 0) { throw new GatewaySenderException( String.format("GatewaySender %s can not be created with dispatcher threads less than 1", if (this.attrs.getSocketReadTimeout() != 0 && this.attrs.getSocketReadTimeout() < GatewaySender.MINIMUM_SOCKET_READ_TIMEOUT) { logger.warn( "{} cannot configure socket read timeout of {} milliseconds because it is less than the minimum of {} milliseconds. The default will be used instead.", new Object[] {"GatewaySender " + id, this.attrs.getSocketReadTimeout(), GatewaySender.MINIMUM_SOCKET_READ_TIMEOUT}); this.attrs.socketReadTimeout = GatewaySender.MINIMUM_SOCKET_READ_TIMEOUT; if (this.attrs.isParallel()) { if ((this.attrs.getOrderPolicy() != null) && this.attrs.getOrderPolicy().equals(OrderPolicy.THREAD)) { throw new GatewaySenderException( String.format("Parallel Gateway Sender %s can not be created with OrderPolicy %s", id, this.attrs.getOrderPolicy())); if (!this.attrs.isManualStart()) { sender.start(); if (this.attrs.getAsyncEventListeners().size() > 0) { throw new GatewaySenderException( String.format( if (this.attrs.getOrderPolicy() == null && this.attrs.getDispatcherThreads() > 1) { this.attrs.policy = GatewaySender.DEFAULT_ORDER_POLICY;
GatewaySender sender = null; if (this.attrs.getDispatcherThreads() <= 0) { throw new AsyncEventQueueConfigurationException( String.format("AsyncEventQueue %s can not be created with dispatcher threads less than 1", if (this.attrs.isParallel()) { if ((this.attrs.getOrderPolicy() != null) && this.attrs.getOrderPolicy().equals(OrderPolicy.THREAD)) { throw new AsyncEventQueueConfigurationException( String.format( "AsyncEventQueue %s can not be created with OrderPolicy %s when it is set parallel", id, this.attrs.getOrderPolicy())); sender = new ParallelGatewaySenderImpl(this.cache, this.attrs); this.cache.addGatewaySender(sender); if (!this.attrs.isManualStart()) { sender.start(); if (this.attrs.getOrderPolicy() == null && this.attrs.getDispatcherThreads() > 1) { this.attrs.policy = GatewaySender.DEFAULT_ORDER_POLICY; sender = new SerialGatewaySenderImpl(this.cache, this.attrs); this.cache.addGatewaySender(sender); if (!this.attrs.isManualStart()) { sender.start();
private GatewaySender create(String id) { gatewaySenderAttributes.id = id; if (gatewaySenderAttributes.getDispatcherThreads() <= 0) { throw new AsyncEventQueueConfigurationException( String.format("AsyncEventQueue %s can not be created with dispatcher threads less than 1", if (gatewaySenderAttributes.isParallel()) { if (gatewaySenderAttributes.getOrderPolicy() != null && gatewaySenderAttributes.getOrderPolicy().equals(OrderPolicy.THREAD)) { throw new AsyncEventQueueConfigurationException( String.format( "AsyncEventQueue %s can not be created with OrderPolicy %s when it is set parallel", id, gatewaySenderAttributes.getOrderPolicy())); if (gatewaySenderAttributes.getOrderPolicy() == null && gatewaySenderAttributes.getDispatcherThreads() > 1) { gatewaySenderAttributes.policy = GatewaySender.DEFAULT_ORDER_POLICY;
@Override public AsyncEventQueue create(String asyncQueueId, AsyncEventListener listener) { if (listener == null) { throw new IllegalArgumentException( "AsyncEventListener cannot be null"); } AsyncEventQueue asyncEventQueue; if (cache instanceof CacheCreation) { asyncEventQueue = new AsyncEventQueueCreation(asyncQueueId, gatewaySenderAttributes, listener); ((CacheCreation) cache).addAsyncEventQueue(asyncEventQueue); } else { if (logger.isDebugEnabled()) { logger.debug("Creating GatewaySender that underlies the AsyncEventQueue"); } addAsyncEventListener(listener); InternalGatewaySender sender = (InternalGatewaySender) create(getSenderIdFromAsyncEventQueueId(asyncQueueId)); AsyncEventQueueImpl asyncEventQueueImpl = new AsyncEventQueueImpl(sender, listener); asyncEventQueue = asyncEventQueueImpl; cache.addAsyncEventQueue(asyncEventQueueImpl); if (!gatewaySenderAttributes.isManualStart()) { sender.start(); } } if (logger.isDebugEnabled()) { logger.debug("Returning AsyncEventQueue" + asyncEventQueue); } return asyncEventQueue; }
@Override public GatewaySenderFactory addGatewayTransportFilter(GatewayTransportFilter filter) { this.attrs.addGatewayTransportFilter(filter); return this; }
public AsyncEventQueueFactory addAsyncEventListener(AsyncEventListener listener) { gatewaySenderAttributes.addAsyncEventListener(listener); return this; }
@Override public GatewaySenderFactory addGatewayEventFilter(GatewayEventFilter filter) { this.attrs.addGatewayEventFilter(filter); return this; }