Package org.springframework.data.keyvalue.redis.connection.util

Examples of org.springframework.data.keyvalue.redis.connection.util.ByteArrayWrapper


    boolean trace = logger.isTraceEnabled();

    for (Topic topic : topics) {

      ByteArrayWrapper holder = new ByteArrayWrapper(serializer.serialize(topic.getTopic()));

      if (topic instanceof ChannelTopic) {
        Collection<MessageListener> collection = channelMapping.get(holder);
        if (collection == null) {
          collection = new CopyOnWriteArraySet<MessageListener>();
          channelMapping.put(holder, collection);
        }
        collection.add(listener);
        channels.add(holder.getArray());

        if (trace)
          logger.trace("Adding listener '" + listener + "' on channel '" + topic.getTopic() + "'");
      }

      else if (topic instanceof PatternTopic) {
        Collection<MessageListener> collection = patternMapping.get(holder);
        if (collection == null) {
          collection = new CopyOnWriteArraySet<MessageListener>();
          patternMapping.put(holder, collection);
        }
        collection.add(listener);
        patterns.add(holder.getArray());

        if (trace)
          logger.trace("Adding listener '" + listener + "' for pattern '" + topic.getTopic() + "'");
      }
View Full Code Here


    @Override
    public void onMessage(Message message, byte[] pattern) {
      // do channel matching first
      byte[] channel = message.getChannel();

      Collection<MessageListener> ch = channelMapping.get(new ByteArrayWrapper(channel));
      Collection<MessageListener> pt = null;

      // followed by pattern matching
      if (pattern != null && pattern.length > 0) {
        pt = patternMapping.get(new ByteArrayWrapper(pattern));
      }

      if (!CollectionUtils.isEmpty(ch)) {
        dispatchChannels(ch, message);
      }
View Full Code Here

TOP

Related Classes of org.springframework.data.keyvalue.redis.connection.util.ByteArrayWrapper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.