Java Code Examples for org.redisson.client.RedisConnection#closeAsync()
The following examples show how to use
org.redisson.client.RedisConnection#closeAsync() .
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: RedisRunner.java From redisson with Apache License 2.0 | 5 votes |
public RedisVersion getRedisVersion() { if (redisVersion == null) { RedisConnection c = createRedisClientInstance().connect(); Map<String, String> serverMap = c.sync(RedisCommands.INFO_SERVER); redisVersion = new RedisVersion(serverMap.get("redis_version")); c.closeAsync(); } return redisVersion; }
Example 2
Source File: RedisRunner.java From redisson with Apache License 2.0 | 5 votes |
public RedisVersion getRedisVersion() { if (redisVersion == null) { RedisConnection c = createRedisClientInstance().connect(); Map<String, String> serverMap = c.sync(RedisCommands.INFO_SERVER); redisVersion = new RedisVersion(serverMap.get("redis_version")); c.closeAsync(); } return redisVersion; }
Example 3
Source File: RedisRunner.java From redisson with Apache License 2.0 | 5 votes |
public RedisVersion getRedisVersion() { if (redisVersion == null) { RedisConnection c = createRedisClientInstance().connect(); Map<String, String> serverMap = c.sync(RedisCommands.INFO_SERVER); redisVersion = new RedisVersion(serverMap.get("redis_version")); c.closeAsync(); } return redisVersion; }
Example 4
Source File: RedisRunner.java From redisson with Apache License 2.0 | 5 votes |
public RedisVersion getRedisVersion() { if (redisVersion == null) { RedisConnection c = createRedisClientInstance().connect(); Map<String, String> serverMap = c.sync(RedisCommands.INFO_SERVER); redisVersion = new RedisVersion(serverMap.get("redis_version")); c.closeAsync(); } return redisVersion; }
Example 5
Source File: RedisRunner.java From redisson with Apache License 2.0 | 5 votes |
public RedisVersion getRedisVersion() { if (redisVersion == null) { RedisConnection c = createRedisClientInstance().connect(); Map<String, String> serverMap = c.sync(RedisCommands.INFO_SERVER); redisVersion = new RedisVersion(serverMap.get("redis_version")); c.closeAsync(); } return redisVersion; }
Example 6
Source File: RedisRunner.java From redisson with Apache License 2.0 | 5 votes |
public RedisVersion getRedisVersion() { if (redisVersion == null) { RedisConnection c = createRedisClientInstance().connect(); Map<String, String> serverMap = c.sync(RedisCommands.INFO_SERVER); redisVersion = new RedisVersion(serverMap.get("redis_version")); c.closeAsync(); } return redisVersion; }
Example 7
Source File: RedisRunner.java From redisson with Apache License 2.0 | 5 votes |
public RedisVersion getRedisVersion() { if (redisVersion == null) { RedisConnection c = createRedisClientInstance().connect(); Map<String, String> serverMap = c.sync(RedisCommands.INFO_SERVER); redisVersion = new RedisVersion(serverMap.get("redis_version")); c.closeAsync(); } return redisVersion; }
Example 8
Source File: ClientConnectionsEntry.java From redisson with Apache License 2.0 | 5 votes |
public void releaseConnection(RedisConnection connection) { if (client != connection.getRedisClient()) { connection.closeAsync(); return; } connection.setLastUsageTime(System.currentTimeMillis()); freeConnections.add(connection); }
Example 9
Source File: MasterSlaveConnectionManager.java From redisson with Apache License 2.0 | 5 votes |
protected final RFuture<RedisConnection> connectToNode(BaseMasterSlaveServersConfig<?> cfg, RedisURI addr, RedisClient client, String sslHostname) { final Object key; if (client != null) { key = client; } else { key = addr; } RedisConnection conn = nodeConnections.get(key); if (conn != null) { if (!conn.isActive()) { nodeConnections.remove(key); conn.closeAsync(); } else { return RedissonPromise.newSucceededFuture(conn); } } if (addr != null) { client = createClient(NodeType.MASTER, addr, cfg.getConnectTimeout(), cfg.getTimeout(), sslHostname); } final RPromise<RedisConnection> result = new RedissonPromise<RedisConnection>(); RFuture<RedisConnection> future = client.connectAsync(); future.onComplete((connection, e) -> { if (e != null) { result.tryFailure(e); return; } if (connection.isActive()) { nodeConnections.put(key, connection); result.trySuccess(connection); } else { connection.closeAsync(); result.tryFailure(new RedisException("Connection to " + connection.getRedisClient().getAddr() + " is not active!")); } }); return result; }
Example 10
Source File: RedisRunner.java From redisson with Apache License 2.0 | 5 votes |
public RedisVersion getRedisVersion() { if (redisVersion == null) { RedisConnection c = createRedisClientInstance().connect(); Map<String, String> serverMap = c.sync(RedisCommands.INFO_SERVER); redisVersion = new RedisVersion(serverMap.get("redis_version")); c.closeAsync(); } return redisVersion; }
Example 11
Source File: RedissonIntegrationTest.java From tutorials with MIT License | 5 votes |
@Test public void givenLowLevelRedisCommands_thenExecuteLowLevelCommandsOnRedis(){ RedisClientConfig redisClientConfig = new RedisClientConfig(); redisClientConfig.setAddress("localhost", 6379); RedisClient client = RedisClient.create(redisClientConfig); RedisConnection conn = client.connect(); conn.sync(StringCodec.INSTANCE, RedisCommands.SET, "test", 0); String testValue = conn.sync(StringCodec.INSTANCE, RedisCommands.GET, "test"); conn.closeAsync(); client.shutdown(); assertTrue(testValue.equals("0")); }
Example 12
Source File: MasterSlaveConnectionManager.java From redisson with Apache License 2.0 | 4 votes |
protected void closeNodeConnection(RedisConnection conn) { if (nodeConnections.values().remove(conn)) { conn.closeAsync(); } }
Example 13
Source File: MasterSlaveConnectionManager.java From redisson with Apache License 2.0 | 4 votes |
protected final void disconnectNode(RedisURI addr) { RedisConnection conn = nodeConnections.remove(addr); if (conn != null) { conn.closeAsync(); } }
Example 14
Source File: MasterSlaveConnectionManager.java From redisson with Apache License 2.0 | 4 votes |
protected final void disconnectNode(RedisClient client) { RedisConnection conn = nodeConnections.remove(client); if (conn != null) { conn.closeAsync(); } }