@Override public <K, V> Map<K, V> createMap(String name) { return redisClient.getMap(name); }
public RedissonStore(UUID sessionId, RedissonClient redisson) { this.map = redisson.getMap(sessionId.toString()); }
@Override public R call() throws Exception { this.codec = (Codec) codecClass.getConstructor().newInstance(); Injector.inject(collator, redisson); RMap<KOut, VOut> resultMap = redisson.getMap(resultMapName, codec); R result = collator.collate(resultMap); resultMap.delete(); return result; }
@Override public R call() throws Exception { this.codec = (Codec) codecClass.getConstructor().newInstance(); Injector.inject(collator, redisson); RMap<KOut, VOut> resultMap = redisson.getMap(resultMapName, codec); R result = collator.collate(resultMap); resultMap.delete(); return result; }
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())); }
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); }
@Override public void scheduleWithFixedDelay(ScheduledWithFixedDelayParameters params) { executeRunnable(params, false); if (!redisson.getMap(tasksName, StringCodec.INSTANCE).containsKey(params.getRequestId())) { return; } long newStartTime = System.currentTimeMillis() + params.getDelay(); params.setStartTime(newStartTime); asyncScheduledServiceAtFixed(params.getExecutorId(), params.getRequestId()).scheduleWithFixedDelay(params); }
@Override public void scheduleWithFixedDelay(ScheduledWithFixedDelayParameters params) { executeRunnable(params, false); if (!redisson.getMap(tasksName, StringCodec.INSTANCE).containsKey(params.getRequestId())) { return; } long newStartTime = System.currentTimeMillis() + params.getDelay(); params.setStartTime(newStartTime); asyncScheduledServiceAtFixed(params.getExecutorId(), params.getRequestId()).scheduleWithFixedDelay(params); }
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()); }
@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); } } } });
private void cancelExecution(RemoteInvocationOptions optionsCopy, boolean mayInterruptIfRunning, RemotePromise<Object> remotePromise) { RMap<String, RemoteServiceCancelRequest> canceledRequests = redisson.getMap(cancelRequestMapName, new CompositeCodec(StringCodec.INSTANCE, codec, codec)); canceledRequests.fastPutAsync(remotePromise.getRequestId().toString(), new RemoteServiceCancelRequest(mayInterruptIfRunning, false)); canceledRequests.expireAsync(60, TimeUnit.SECONDS); // subscribe for async result if it's not expected before if (!optionsCopy.isResultExpected()) { RemoteInvocationOptions options = new RemoteInvocationOptions(optionsCopy); options.expectResultWithin(60, TimeUnit.SECONDS); RFuture<RRemoteServiceResponse> responseFuture = pollResponse(options.getExecutionTimeoutInMillis(), remotePromise.getRequestId(), false); awaitResultAsync(options, remotePromise, responseFuture); } }
private void cancelExecution(RemoteInvocationOptions optionsCopy, boolean mayInterruptIfRunning, RemotePromise<Object> remotePromise) { RMap<String, RemoteServiceCancelRequest> canceledRequests = redisson.getMap(cancelRequestMapName, new CompositeCodec(StringCodec.INSTANCE, codec, codec)); canceledRequests.fastPutAsync(remotePromise.getRequestId().toString(), new RemoteServiceCancelRequest(mayInterruptIfRunning, false)); canceledRequests.expireAsync(60, TimeUnit.SECONDS); // subscribe for async result if it's not expected before if (!optionsCopy.isResultExpected()) { RemoteInvocationOptions options = new RemoteInvocationOptions(optionsCopy); options.expectResultWithin(60, TimeUnit.SECONDS); RFuture<RRemoteServiceResponse> responseFuture = pollResponse(options.getExecutionTimeoutInMillis(), remotePromise.getRequestId(), false); awaitResultAsync(options, remotePromise, responseFuture); } }