Java Code Examples for org.redisson.config.MasterSlaveServersConfig#getRetryInterval()

The following examples show how to use org.redisson.config.MasterSlaveServersConfig#getRetryInterval() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MasterSlaveConnectionManager.java    From redisson with Apache License 2.0 6 votes vote down vote up
protected void initTimer(MasterSlaveServersConfig config) {
    int[] timeouts = new int[]{config.getRetryInterval(), config.getTimeout()};
    Arrays.sort(timeouts);
    int minTimeout = timeouts[0];
    if (minTimeout % 100 != 0) {
        minTimeout = (minTimeout % 100) / 2;
    } else if (minTimeout == 100) {
        minTimeout = 50;
    } else {
        minTimeout = 100;
    }
    
    timer = new HashedWheelTimer(new DefaultThreadFactory("redisson-timer"), minTimeout, TimeUnit.MILLISECONDS, 1024, false);
    
    connectionWatcher = new IdleConnectionWatcher(this, config);
    subscribeService = new PublishSubscribeService(this, config);
}
 
Example 2
Source File: RedissonPatternTopic.java    From redisson with Apache License 2.0 5 votes vote down vote up
protected void acquire(AsyncSemaphore semaphore) {
    MasterSlaveServersConfig config = commandExecutor.getConnectionManager().getConfig();
    int timeout = config.getTimeout() + config.getRetryInterval() * config.getRetryAttempts();
    if (!semaphore.tryAcquire(timeout)) {
        throw new RedisTimeoutException("Remove listeners operation timeout: (" + timeout + "ms) for " + name + " topic");
    }
}
 
Example 3
Source File: CommandAsyncService.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Override
public void syncSubscription(RFuture<?> future) {
    MasterSlaveServersConfig config = connectionManager.getConfig();
    try {
        int timeout = config.getTimeout() + config.getRetryInterval() * config.getRetryAttempts();
        if (!future.await(timeout)) {
            ((RPromise<?>) future).tryFailure(new RedisTimeoutException("Subscribe timeout: (" + timeout + "ms). Increase 'subscriptionsPerConnection' and/or 'subscriptionConnectionPoolSize' parameters."));
        }
    } catch (InterruptedException e) {
        Thread.currentThread().interrupt();
    }
    future.syncUninterruptibly();
}
 
Example 4
Source File: CommandAsyncService.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Override
public void syncSubscriptionInterrupted(RFuture<?> future) throws InterruptedException {
    MasterSlaveServersConfig config = connectionManager.getConfig();
    int timeout = config.getTimeout() + config.getRetryInterval() * config.getRetryAttempts();
    if (!future.await(timeout)) {
        ((RPromise<?>) future).tryFailure(new RedisTimeoutException("Subscribe timeout: (" + timeout + "ms). Increase 'subscriptionsPerConnection' and/or 'subscriptionConnectionPoolSize' parameters."));
    }
    future.sync();
}
 
Example 5
Source File: RedissonTopic.java    From redisson with Apache License 2.0 5 votes vote down vote up
protected void acquire(AsyncSemaphore semaphore) {
    MasterSlaveServersConfig config = commandExecutor.getConnectionManager().getConfig();
    int timeout = config.getTimeout() + config.getRetryInterval() * config.getRetryAttempts();
    if (!semaphore.tryAcquire(timeout)) {
        throw new RedisTimeoutException("Remove listeners operation timeout: (" + timeout + "ms) for " + name + " topic");
    }
}