use of org.apache.geode.internal.cache.wan.GatewaySenderEventRemoteDispatcher in project geode by apache.
the class RemoteParallelGatewaySenderEventProcessor method shouldSendVersionEvents.
/**
* Returns if corresponding receiver WAN site of this GatewaySender has GemfireVersion > 7.0.1
*
* @param disp
* @return true if remote site Gemfire Version is >= 7.0.1
*/
private boolean shouldSendVersionEvents(GatewaySenderEventDispatcher disp) throws GatewaySenderException {
try {
GatewaySenderEventRemoteDispatcher remoteDispatcher = (GatewaySenderEventRemoteDispatcher) disp;
// This will create a new connection if no batch has been sent till
// now.
Connection conn = remoteDispatcher.getConnection(false);
if (conn != null) {
short remoteSiteVersion = conn.getWanSiteVersion();
if (Version.GFE_701.compareTo(remoteSiteVersion) <= 0) {
return true;
}
}
} catch (GatewaySenderException e) {
Throwable cause = e.getCause();
if (cause instanceof IOException || e instanceof GatewaySenderConfigurationException || cause instanceof ConnectionDestroyedException) {
try {
int sleepInterval = GatewaySender.CONNECTION_RETRY_INTERVAL;
if (logger.isDebugEnabled()) {
logger.debug("Sleeping for {} milliseconds", sleepInterval);
}
Thread.sleep(sleepInterval);
} catch (InterruptedException ie) {
// log the exception
if (logger.isDebugEnabled()) {
logger.debug(ie.getMessage(), ie);
}
}
}
throw e;
}
return false;
}
use of org.apache.geode.internal.cache.wan.GatewaySenderEventRemoteDispatcher in project geode by apache.
the class RemoteParallelGatewaySenderEventProcessor method rebalance.
@Override
protected void rebalance() {
GatewaySenderStats statistics = this.sender.getStatistics();
long startTime = statistics.startLoadBalance();
try {
if (this.dispatcher.isRemoteDispatcher()) {
GatewaySenderEventRemoteDispatcher remoteDispatcher = (GatewaySenderEventRemoteDispatcher) this.dispatcher;
if (remoteDispatcher.isConnectedToRemote()) {
remoteDispatcher.stopAckReaderThread();
remoteDispatcher.destroyConnection();
}
}
} finally {
statistics.endLoadBalance(startTime);
}
}
use of org.apache.geode.internal.cache.wan.GatewaySenderEventRemoteDispatcher in project geode by apache.
the class RemoteConcurrentParallelGatewaySenderEventProcessor method rebalance.
@Override
protected void rebalance() {
GatewaySenderStats statistics = this.sender.getStatistics();
long startTime = statistics.startLoadBalance();
try {
for (ParallelGatewaySenderEventProcessor parallelProcessor : this.processors) {
GatewaySenderEventRemoteDispatcher remoteDispatcher = (GatewaySenderEventRemoteDispatcher) parallelProcessor.getDispatcher();
if (remoteDispatcher.isConnectedToRemote()) {
remoteDispatcher.stopAckReaderThread();
remoteDispatcher.destroyConnection();
}
}
} finally {
statistics.endLoadBalance(startTime);
}
}
Aggregations