use of org.apache.geode.internal.cache.xmlcache.ParallelAsyncEventQueueCreation 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;
}
Aggregations