public RMap<String, Object> getMap(String sessionId) { String separator = keyPrefix == null || keyPrefix.isEmpty() ? "" : ":"; String name = keyPrefix + separator + "redisson:tomcat_session:" + sessionId; return redisson.getMap(name, new CompositeCodec(StringCodec.INSTANCE, redisson.getConfig().getCodec())); }
public RMap<String, Object> getMap(String sessionId) { String separator = keyPrefix == null || keyPrefix.isEmpty() ? "" : ":"; String name = keyPrefix + separator + "redisson:tomcat_session:" + sessionId; return redisson.getMap(name, new CompositeCodec(StringCodec.INSTANCE, redisson.getConfig().getCodec())); }
public RMap<String, Object> getMap(String sessionId) { String separator = keyPrefix == null || keyPrefix.isEmpty() ? "" : ":"; String name = keyPrefix + separator + "redisson:tomcat_session:" + sessionId; return redisson.getMap(name, new CompositeCodec(StringCodec.INSTANCE, redisson.getConfig().getCodec())); }
public RMap<String, Object> getMap(String sessionId) { String separator = keyPrefix == null || keyPrefix.isEmpty() ? "" : ":"; String name = keyPrefix + separator + "redisson:tomcat_session:" + sessionId; return redisson.getMap(name, new CompositeCodec(StringCodec.INSTANCE, redisson.getConfig().getCodec())); }
@Override public <V> RFuture<Map<String, V>> getAsync(String... keys) { if (keys.length == 0) { Map<String, V> emptyMap = Collections.emptyMap(); return RedissonPromise.<Map<String, V>>newSucceededFuture(emptyMap); } RedisCommand<Map<Object, Object>> command = new RedisCommand<Map<Object, Object>>("MGET", new MapGetAllDecoder(Arrays.<Object>asList(keys), 0)); return commandExecutor.readAsync(keys[0], new CompositeCodec(StringCodec.INSTANCE, codec, codec), command, keys); }
@Override public <V> RFuture<Map<String, V>> getAsync(String... keys) { if (keys.length == 0) { Map<String, V> emptyMap = Collections.emptyMap(); return RedissonPromise.<Map<String, V>>newSucceededFuture(emptyMap); } RedisCommand<Map<Object, Object>> command = new RedisCommand<Map<Object, Object>>("MGET", new MapGetAllDecoder(Arrays.<Object>asList(keys), 0)); return commandExecutor.readAsync(keys[0], new CompositeCodec(StringCodec.INSTANCE, codec, codec), command, keys); }
RMap<String, T> canceledRequests = redisson.getMap(mapName, new CompositeCodec(StringCodec.INSTANCE, codec, codec)); RFuture<T> future = canceledRequests.removeAsync(requestId.toString()); future.addListener(new FutureListener<T>() {
RMap<String, T> canceledRequests = redisson.getMap(mapName, new CompositeCodec(StringCodec.INSTANCE, codec, codec)); RFuture<T> future = canceledRequests.removeAsync(requestId.toString()); future.addListener(new FutureListener<T>() {
MapScanResult<Object, Object> scanIterator(RedisClient client, long startPos) { RFuture<MapScanResult<Object, Object>> f = commandExecutor.readAsync(client, getName(), new CompositeCodec(codec, StringCodec.INSTANCE, codec), RedisCommands.HSCAN, getName(), startPos); return get(f); }
MapScanResult<Object, Object> scanIterator(RedisClient client, long startPos) { RFuture<MapScanResult<Object, Object>> f = commandExecutor.readAsync(client, getName(), new CompositeCodec(codec, StringCodec.INSTANCE, codec), RedisCommands.HSCAN, getName(), startPos); return get(f); }
public RedissonSession(String keyPrefix, String sessionId) { this.delegate = new MapSession(sessionId); map = redisson.getMap(keyPrefix + sessionId, new CompositeCodec(StringCodec.INSTANCE, redisson.getConfig().getCodec())); principalName = resolvePrincipal(delegate); }
public RedissonSession(String keyPrefix, String sessionId) { this.delegate = new MapSession(sessionId); map = redisson.getMap(keyPrefix + sessionId, new CompositeCodec(StringCodec.INSTANCE, redisson.getConfig().getCodec())); principalName = resolvePrincipal(delegate); }
RMap<String, RemoteServiceRequest> tasks = redisson.getMap(requestQueue.getName() + ":tasks", new CompositeCodec(StringCodec.INSTANCE, codec, codec)); RFuture<RemoteServiceRequest> taskFuture = getTask(requestId, tasks); taskFuture.addListener(new FutureListener<RemoteServiceRequest>() {
public RedissonSession(String keyPrefix) { this.delegate = new MapSession(); map = redisson.getMap(keyPrefix + delegate.getId(), new CompositeCodec(StringCodec.INSTANCE, redisson.getConfig().getCodec())); principalName = resolvePrincipal(delegate); Map<String, Object> newMap = new HashMap<String, Object>(3); newMap.put("session:creationTime", delegate.getCreationTime()); newMap.put("session:lastAccessedTime", delegate.getLastAccessedTime()); newMap.put("session:maxInactiveInterval", delegate.getMaxInactiveIntervalInSeconds()); map.putAll(newMap); updateExpiration(); String channelName = getEventsChannelName(delegate.getId()); RTopic topic = redisson.getTopic(channelName, StringCodec.INSTANCE); topic.publish(delegate.getId()); }
public RedissonSession(String keyPrefix) { this.delegate = new MapSession(); map = redisson.getMap(keyPrefix + delegate.getId(), new CompositeCodec(StringCodec.INSTANCE, redisson.getConfig().getCodec())); principalName = resolvePrincipal(delegate); Map<String, Object> newMap = new HashMap<String, Object>(3); newMap.put("session:creationTime", delegate.getCreationTime()); newMap.put("session:lastAccessedTime", delegate.getLastAccessedTime()); newMap.put("session:maxInactiveInterval", delegate.getMaxInactiveIntervalInSeconds()); map.putAll(newMap); updateExpiration(); String channelName = getEventsChannelName(delegate.getId()); RTopic topic = redisson.getTopic(channelName, StringCodec.INSTANCE); topic.publish(delegate.getId()); }
RMap<String, RemoteServiceRequest> tasks = redisson.getMap(requestQueue.getName() + ":tasks", new CompositeCodec(StringCodec.INSTANCE, codec, codec)); RFuture<RemoteServiceRequest> taskFuture = getTask(requestId, tasks); taskFuture.addListener(new FutureListener<RemoteServiceRequest>() {
@Override public void operationComplete(Future<RemoteServiceCancelRequest> future) throws Exception { if (!future.isSuccess()) { return; } boolean res = submitFuture.cancel(future.getNow().isMayInterruptIfRunning()); if (res) { RemoteServiceCancelResponse response = new RemoteServiceCancelResponse(request.getId(), true); if (!responseHolder.compareAndSet(null, response)) { response = new RemoteServiceCancelResponse(request.getId(), false); } // could be removed not from future object if (future.getNow().isSendResponse()) { RMap<String, RemoteServiceCancelResponse> map = redisson.getMap(cancelResponseMapName, new CompositeCodec(StringCodec.INSTANCE, codec, codec)); map.fastPutAsync(request.getId(), response); map.expireAsync(60, TimeUnit.SECONDS); } } } });
@Override public void operationComplete(Future<RemoteServiceCancelRequest> future) throws Exception { if (!future.isSuccess()) { return; } boolean res = submitFuture.cancel(future.getNow().isMayInterruptIfRunning()); if (res) { RemoteServiceCancelResponse response = new RemoteServiceCancelResponse(request.getId(), true); if (!responseHolder.compareAndSet(null, response)) { response = new RemoteServiceCancelResponse(request.getId(), false); } // could be removed not from future object if (future.getNow().isSendResponse()) { RMap<String, RemoteServiceCancelResponse> map = redisson.getMap(cancelResponseMapName, new CompositeCodec(StringCodec.INSTANCE, codec, codec)); map.fastPutAsync(request.getId(), response); map.expireAsync(60, TimeUnit.SECONDS); } } } });
@Override public void run(Timeout timeout) throws Exception { if (cancelRequest.isDone()) { return; } RMap<String, T> canceledRequests = redisson.getMap(mapName, new CompositeCodec(StringCodec.INSTANCE, codec, codec)); RFuture<T> future = canceledRequests.removeAsync(requestId.toString()); future.addListener(new FutureListener<T>() { @Override public void operationComplete(Future<T> future) throws Exception { if (cancelRequest.isDone()) { return; } if (!future.isSuccess()) { scheduleCheck(mapName, requestId, cancelRequest); return; } T request = future.getNow(); if (request == null) { scheduleCheck(mapName, requestId, cancelRequest); } else { cancelRequest.trySuccess(request); } } }); } }, 3000, TimeUnit.MILLISECONDS);
@Override public void run(Timeout timeout) throws Exception { if (cancelRequest.isDone()) { return; } RMap<String, T> canceledRequests = redisson.getMap(mapName, new CompositeCodec(StringCodec.INSTANCE, codec, codec)); RFuture<T> future = canceledRequests.removeAsync(requestId.toString()); future.addListener(new FutureListener<T>() { @Override public void operationComplete(Future<T> future) throws Exception { if (cancelRequest.isDone()) { return; } if (!future.isSuccess()) { scheduleCheck(mapName, requestId, cancelRequest); return; } T request = future.getNow(); if (request == null) { scheduleCheck(mapName, requestId, cancelRequest); } else { cancelRequest.trySuccess(request); } } }); } }, 3000, TimeUnit.MILLISECONDS);