Java Code Examples for org.redisson.api.RFuture#syncUninterruptibly()

The following examples show how to use org.redisson.api.RFuture#syncUninterruptibly() . 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 initSingleEntry() {
    try {
        MasterSlaveEntry entry;
        if (config.checkSkipSlavesInit()) {
            entry = new SingleEntry(this, config);
        } else {
            entry = createMasterSlaveEntry(config);
        }
        RFuture<RedisClient> f = entry.setupMasterEntry(new RedisURI(config.getMasterAddress()));
        f.syncUninterruptibly();
    
        for (int slot = singleSlotRange.getStartSlot(); slot < singleSlotRange.getEndSlot() + 1; slot++) {
            addEntry(slot, entry);
        }
        
        startDNSMonitoring(f.getNow());
    } catch (Exception e) {
        stopThreads();
        throw e;
    }
}
 
Example 2
Source File: RedissonConnection.java    From redisson with Apache License 2.0 5 votes vote down vote up
protected <T> T sync(RFuture<T> f) {
    if (isPipelined()) {
        return null;
    }
    if (isQueueing()) {
        f.syncUninterruptibly();
        return null;
    }

    return syncFuture(f);
}
 
Example 3
Source File: RedissonConnection.java    From redisson with Apache License 2.0 5 votes vote down vote up
protected <T> T sync(RFuture<T> f) {
    if (isPipelined()) {
        return null;
    }
    if (isQueueing()) {
        f.syncUninterruptibly();
        return null;
    }

    return syncFuture(f);
}
 
Example 4
Source File: RedissonConnection.java    From redisson with Apache License 2.0 5 votes vote down vote up
protected <T> T sync(RFuture<T> f) {
    if (isPipelined()) {
        return null;
    }
    if (isQueueing()) {
        f.syncUninterruptibly();
        return null;
    }

    return syncFuture(f);
}
 
Example 5
Source File: RedissonConnection.java    From redisson with Apache License 2.0 5 votes vote down vote up
protected <T> T sync(RFuture<T> f) {
    if (isPipelined()) {
        return null;
    }
    if (isQueueing()) {
        f.syncUninterruptibly();
        return null;
    }

    return syncFuture(f);
}
 
Example 6
Source File: RedissonConnection.java    From redisson with Apache License 2.0 5 votes vote down vote up
protected <T> T sync(RFuture<T> f) {
    if (isPipelined()) {
        return null;
    }
    if (isQueueing()) {
        f.syncUninterruptibly();
        return null;
    }

    return syncFuture(f);
}
 
Example 7
Source File: RedissonConnection.java    From redisson with Apache License 2.0 5 votes vote down vote up
protected <T> T sync(RFuture<T> f) {
    if (isPipelined()) {
        return null;
    }
    if (isQueueing()) {
        f.syncUninterruptibly();
        return null;
    }

    return syncFuture(f);
}
 
Example 8
Source File: RedissonConnection.java    From redisson with Apache License 2.0 5 votes vote down vote up
protected <T> T sync(RFuture<T> f) {
    if (isPipelined()) {
        return null;
    }
    if (isQueueing()) {
        f.syncUninterruptibly();
        return null;
    }

    return syncFuture(f);
}
 
Example 9
Source File: SentinelConnectionManager.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Override
protected MasterSlaveEntry createMasterSlaveEntry(MasterSlaveServersConfig config) {
    MasterSlaveEntry entry = new MasterSlaveEntry(this, config);
    List<RFuture<Void>> fs = entry.initSlaveBalancer(disconnectedSlaves);
    for (RFuture<Void> future : fs) {
        future.syncUninterruptibly();
    }
    return entry;
}
 
Example 10
Source File: MasterSlaveConnectionManager.java    From redisson with Apache License 2.0 5 votes vote down vote up
protected MasterSlaveEntry createMasterSlaveEntry(MasterSlaveServersConfig config) {
    MasterSlaveEntry entry = new MasterSlaveEntry(this, config);
    List<RFuture<Void>> fs = entry.initSlaveBalancer(java.util.Collections.<RedisURI>emptySet());
    for (RFuture<Void> future : fs) {
        future.syncUninterruptibly();
    }
    return entry;
}
 
Example 11
Source File: RedisQueuedBatchExecutor.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Override
protected RFuture<RedisConnection> getConnection() {
    MasterSlaveEntry msEntry = getEntry(source);
    ConnectionEntry entry = connections.get(msEntry);
    if (entry == null) {
        entry = new ConnectionEntry();
        ConnectionEntry oldEntry = connections.putIfAbsent(msEntry, entry);
        if (oldEntry != null) {
            entry = oldEntry;
        }
    }

    
    if (entry.getConnectionFuture() != null) {
        return entry.getConnectionFuture();
    }
    
    synchronized (this) {
        if (entry.getConnectionFuture() != null) {
            return entry.getConnectionFuture();
        }
    
        RFuture<RedisConnection> connectionFuture;
        if (this.options.getExecutionMode() == ExecutionMode.REDIS_WRITE_ATOMIC) {
            connectionFuture = connectionManager.connectionWriteOp(source, null);
        } else {
            connectionFuture = connectionManager.connectionReadOp(source, null);
        }
        connectionFuture.syncUninterruptibly();
        entry.setConnectionFuture(connectionFuture);
        return connectionFuture;
    }
}
 
Example 12
Source File: RedissonMultiLock.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Override
public void unlock() {
    List<RFuture<Void>> futures = new ArrayList<>(locks.size());

    for (RLock lock : locks) {
        futures.add(lock.unlockAsync());
    }

    for (RFuture<Void> future : futures) {
        future.syncUninterruptibly();
    }
}