Search in sources :

Example 1 with GatewayReceiverCreation

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

the class GatewayReceiverFactoryImpl method create.

public GatewayReceiver create() {
    if (this.startPort > this.endPort) {
        throw new IllegalStateException("Please specify either start port a value which is less than end port.");
    }
    GatewayReceiver recv = null;
    if (this.cache instanceof GemFireCacheImpl) {
        recv = new GatewayReceiverImpl(this.cache, this.startPort, this.endPort, this.timeBetPings, this.socketBuffSize, this.bindAdd, this.filters, this.hostnameForSenders, this.manualStart);
        this.cache.addGatewayReceiver(recv);
        InternalDistributedSystem system = (InternalDistributedSystem) this.cache.getDistributedSystem();
        system.handleResourceEvent(ResourceEvent.GATEWAYRECEIVER_CREATE, recv);
        if (!this.manualStart) {
            try {
                recv.start();
            } catch (IOException ioe) {
                throw new GatewayReceiverException(LocalizedStrings.GatewayReceiver_EXCEPTION_WHILE_STARTING_GATEWAY_RECEIVER.toLocalizedString(), ioe);
            }
        }
    } else if (this.cache instanceof CacheCreation) {
        recv = new GatewayReceiverCreation(this.cache, this.startPort, this.endPort, this.timeBetPings, this.socketBuffSize, this.bindAdd, this.filters, this.hostnameForSenders, this.manualStart);
        this.cache.addGatewayReceiver(recv);
    }
    return recv;
}
Also used : GatewayReceiverCreation(org.apache.geode.internal.cache.xmlcache.GatewayReceiverCreation) GatewayReceiver(org.apache.geode.cache.wan.GatewayReceiver) GemFireCacheImpl(org.apache.geode.internal.cache.GemFireCacheImpl) InternalDistributedSystem(org.apache.geode.distributed.internal.InternalDistributedSystem) IOException(java.io.IOException) CacheCreation(org.apache.geode.internal.cache.xmlcache.CacheCreation)

Aggregations

IOException (java.io.IOException)1 GatewayReceiver (org.apache.geode.cache.wan.GatewayReceiver)1 InternalDistributedSystem (org.apache.geode.distributed.internal.InternalDistributedSystem)1 GemFireCacheImpl (org.apache.geode.internal.cache.GemFireCacheImpl)1 CacheCreation (org.apache.geode.internal.cache.xmlcache.CacheCreation)1 GatewayReceiverCreation (org.apache.geode.internal.cache.xmlcache.GatewayReceiverCreation)1