
org.redisson.client.handler.CommandPubSubDecoder Maven / Gradle / Ivy
/**
* Copyright 2016 Nikita Koksharov
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.redisson.client.handler;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import org.redisson.client.RedisPubSubConnection;
import org.redisson.client.protocol.CommandData;
import org.redisson.client.protocol.Decoder;
import org.redisson.client.protocol.RedisCommands;
import org.redisson.client.protocol.decoder.MultiDecoder;
import org.redisson.client.protocol.pubsub.Message;
import org.redisson.client.protocol.pubsub.PubSubMessage;
import org.redisson.client.protocol.pubsub.PubSubPatternMessage;
import org.redisson.client.protocol.pubsub.PubSubStatusMessage;
import io.netty.channel.Channel;
import io.netty.util.internal.PlatformDependent;
/**
* Redis Publish Subscribe protocol decoder
*
* @author Nikita Koksharov
*
*/
public class CommandPubSubDecoder extends CommandDecoder {
// It is not needed to use concurrent map because responses are coming consecutive
private final Map entries = new HashMap();
private final Map> commands = PlatformDependent.newConcurrentHashMap();
private final ExecutorService executor;
private final boolean keepOrder;
public CommandPubSubDecoder(ExecutorService executor, boolean keepOrder) {
this.executor = executor;
this.keepOrder = keepOrder;
}
public void addPubSubCommand(String channel, CommandData
© 2015 - 2025 Weber Informatics LLC | Privacy Policy