public RTopic getTopic() { String separator = keyPrefix == null || keyPrefix.isEmpty() ? "" : ":"; final String name = keyPrefix + separator + "redisson:tomcat_session_updates:" + getContext().getName(); return redisson.getTopic(name); }
public RTopic getTopic() { String separator = keyPrefix == null || keyPrefix.isEmpty() ? "" : ":"; final String name = keyPrefix + separator + "redisson:tomcat_session_updates:" + ((Context) getContainer()).getName(); return redisson.getTopic(name); }
public RTopic getTopic() { String separator = keyPrefix == null || keyPrefix.isEmpty() ? "" : ":"; final String name = keyPrefix + separator + "redisson:tomcat_session_updates:" + ((Context) getContainer()).getName(); return redisson.getTopic(name); }
public RTopic getTopic() { String separator = keyPrefix == null || keyPrefix.isEmpty() ? "" : ":"; final String name = keyPrefix + separator + "redisson:tomcat_session_updates:" + getContext().getName(); return redisson.getTopic(name); }
@Override public void removeListener(int listenerId) { RTopic removedTopic = redisson.getTopic(getRemovedChannelName()); removedTopic.removeListener(listenerId); RTopic createdTopic = redisson.getTopic(getCreatedChannelName()); createdTopic.removeListener(listenerId); RTopic updatedTopic = redisson.getTopic(getUpdatedChannelName()); updatedTopic.removeListener(listenerId); RTopic expiredTopic = redisson.getTopic(getExpiredChannelName()); expiredTopic.removeListener(listenerId); }
@Override public void removeListener(int listenerId) { RTopic removedTopic = redisson.getTopic(getRemovedChannelName()); removedTopic.removeListener(listenerId); RTopic createdTopic = redisson.getTopic(getCreatedChannelName()); createdTopic.removeListener(listenerId); RTopic updatedTopic = redisson.getTopic(getUpdatedChannelName()); updatedTopic.removeListener(listenerId); RTopic expiredTopic = redisson.getTopic(getExpiredChannelName()); expiredTopic.removeListener(listenerId); }
@Override public void unsubscribe(PubSubType type) { String name = type.toString(); Queue<Integer> regIds = map.remove(name); RTopic topic = redissonSub.getTopic(name); for (Integer id : regIds) { topic.removeListener(id); } }
@Override public <T extends PubSubMessage> void subscribe(PubSubType type, final PubSubListener<T> listener, Class<T> clazz) { String name = type.toString(); RTopic topic = redissonSub.getTopic(name); int regId = topic.addListener(PubSubMessage.class, new MessageListener<PubSubMessage>() { @Override public void onMessage(CharSequence channel, PubSubMessage msg) { if (!nodeId.equals(msg.getNodeId())) { listener.onMessage((T)msg); } } }); Queue<Integer> list = map.get(name); if (list == null) { list = new ConcurrentLinkedQueue<Integer>(); Queue<Integer> oldList = map.putIfAbsent(name, list); if (oldList != null) { list = oldList; } } list.add(regId); }
@Override public void publish(PubSubType type, PubSubMessage msg) { msg.setNodeId(nodeId); redissonPub.getTopic(type.toString()).publish(msg); }
RTopic topic = redisson.getTopic(getRemovedChannelName(), new MapCacheEventCodec(codec, isWindows)); return topic.addListener(List.class, new MessageListener<List<Object>>() { @Override RTopic topic = redisson.getTopic(getCreatedChannelName(), new MapCacheEventCodec(codec, isWindows)); return topic.addListener(List.class, new MessageListener<List<Object>>() { @Override RTopic topic = redisson.getTopic(getUpdatedChannelName(), new MapCacheEventCodec(codec, isWindows)); return topic.addListener(List.class, new MessageListener<List<Object>>() { @Override RTopic topic = redisson.getTopic(getExpiredChannelName(), new MapCacheEventCodec(codec, isWindows)); return topic.addListener(List.class, new MessageListener<List<Object>>() { @Override
RTopic topic = redisson.getTopic(getRemovedChannelName(), new MapCacheEventCodec(codec, isWindows)); return topic.addListener(List.class, new MessageListener<List<Object>>() { @Override RTopic topic = redisson.getTopic(getCreatedChannelName(), new MapCacheEventCodec(codec, isWindows)); return topic.addListener(List.class, new MessageListener<List<Object>>() { @Override RTopic topic = redisson.getTopic(getUpdatedChannelName(), new MapCacheEventCodec(codec, isWindows)); return topic.addListener(List.class, new MessageListener<List<Object>>() { @Override RTopic topic = redisson.getTopic(getExpiredChannelName(), new MapCacheEventCodec(codec, isWindows)); return topic.addListener(List.class, new MessageListener<List<Object>>() { @Override
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()); }
public RedissonBaseAdder(CommandAsyncExecutor connectionManager, String name, RedissonClient redisson) { super(connectionManager, name); topic = redisson.getTopic(suffixName(getName(), "topic"), LongCodec.INSTANCE); semaphore = redisson.getSemaphore(suffixName(getName(), "semaphore")); listenerId = topic.addListener(Long.class, new MessageListener<Long>() {
public RedissonBaseAdder(CommandAsyncExecutor connectionManager, String name, RedissonClient redisson) { super(connectionManager, name); topic = redisson.getTopic(suffixName(getName(), "topic"), LongCodec.INSTANCE); semaphore = redisson.getSemaphore(suffixName(getName(), "semaphore")); listenerId = topic.addListener(Long.class, new MessageListener<Long>() {
public RedissonTioClusterTopic(String channel, RedissonClient redisson) { this.redisson = redisson; this.rtopic = redisson.getTopic(TioClusterConfig.TIO_CLUSTER_TOPIC + channel); }
@Override public void unsubscribe(PubSubType type) { String name = type.toString(); Queue<Integer> regIds = map.remove(name); RTopic topic = redissonSub.getTopic(name); for (Integer id : regIds) { topic.removeListener(id); } }
@Override public void removeListener(int listenerId) { RTopic removedTopic = redisson.getTopic(getRemovedChannelName()); removedTopic.removeListener(listenerId); RTopic createdTopic = redisson.getTopic(getCreatedChannelName()); createdTopic.removeListener(listenerId); RTopic updatedTopic = redisson.getTopic(getUpdatedChannelName()); updatedTopic.removeListener(listenerId); RTopic expiredTopic = redisson.getTopic(getExpiredChannelName()); expiredTopic.removeListener(listenerId); }
/** * Builds a Broadcastchannel that knows how to communicate with Redis. * * @param redissonClient The client to use to communicate with Redis */ public RedisBroadcastChannel(RedissonClient redissonClient) { this.topic = redissonClient.getTopic(REDIS_CHANNEL); this.notifications = PublishSubject.create(); this.topicReadWriteLock = new ReentrantReadWriteLock(); listenerId = topic.addListener((channel, msg) -> { notifications.onNext(msg); }); }
@Override public void publish(PubSubType type, PubSubMessage msg) { msg.setNodeId(nodeId); redissonPub.getTopic(type.toString()).publish(msg); }