Search in sources :

Example 1 with SerialAsyncEventQueueCreation

use of org.apache.geode.internal.cache.xmlcache.SerialAsyncEventQueueCreation in project geode by apache.

the class AsyncEventQueueFactoryImpl method create.

private GatewaySender create(String id) {
    this.attrs.id = id;
    GatewaySender sender = null;
    if (this.attrs.getDispatcherThreads() <= 0) {
        throw new AsyncEventQueueConfigurationException(LocalizedStrings.AsyncEventQueue_0_CANNOT_HAVE_DISPATCHER_THREADS_LESS_THAN_1.toLocalizedString(id));
    }
    if (this.attrs.isParallel()) {
        if ((this.attrs.getOrderPolicy() != null) && this.attrs.getOrderPolicy().equals(OrderPolicy.THREAD)) {
            throw new AsyncEventQueueConfigurationException(LocalizedStrings.AsyncEventQueue_0_CANNOT_BE_CREATED_WITH_ORDER_POLICY_1.toLocalizedString(id, this.attrs.getOrderPolicy()));
        }
        if (this.cache instanceof GemFireCacheImpl) {
            sender = new ParallelAsyncEventQueueImpl(this.cache, this.attrs);
            this.cache.addGatewaySender(sender);
            if (!this.attrs.isManualStart()) {
                sender.start();
            }
        } else if (this.cache instanceof CacheCreation) {
            sender = new ParallelAsyncEventQueueCreation(this.cache, this.attrs);
            ((CacheCreation) this.cache).addGatewaySender(sender);
        }
    } else {
        if (this.attrs.getOrderPolicy() == null && this.attrs.getDispatcherThreads() > 1) {
            this.attrs.policy = GatewaySender.DEFAULT_ORDER_POLICY;
        }
        if (this.cache instanceof GemFireCacheImpl) {
            sender = new SerialAsyncEventQueueImpl(this.cache, this.attrs);
            this.cache.addGatewaySender(sender);
            if (!this.attrs.isManualStart()) {
                sender.start();
            }
        } else if (this.cache instanceof CacheCreation) {
            sender = new SerialAsyncEventQueueCreation(this.cache, this.attrs);
            ((CacheCreation) this.cache).addGatewaySender(sender);
        }
    }
    return sender;
}
Also used : GatewaySender(org.apache.geode.cache.wan.GatewaySender) AsyncEventQueueConfigurationException(org.apache.geode.internal.cache.wan.AsyncEventQueueConfigurationException) ParallelAsyncEventQueueCreation(org.apache.geode.internal.cache.xmlcache.ParallelAsyncEventQueueCreation) GemFireCacheImpl(org.apache.geode.internal.cache.GemFireCacheImpl) SerialAsyncEventQueueCreation(org.apache.geode.internal.cache.xmlcache.SerialAsyncEventQueueCreation) CacheCreation(org.apache.geode.internal.cache.xmlcache.CacheCreation)

Aggregations

GatewaySender (org.apache.geode.cache.wan.GatewaySender)1 GemFireCacheImpl (org.apache.geode.internal.cache.GemFireCacheImpl)1 AsyncEventQueueConfigurationException (org.apache.geode.internal.cache.wan.AsyncEventQueueConfigurationException)1 CacheCreation (org.apache.geode.internal.cache.xmlcache.CacheCreation)1 ParallelAsyncEventQueueCreation (org.apache.geode.internal.cache.xmlcache.ParallelAsyncEventQueueCreation)1 SerialAsyncEventQueueCreation (org.apache.geode.internal.cache.xmlcache.SerialAsyncEventQueueCreation)1