Code example for ConcurrentHashMap

0
/** 
 * ¶©ÔÄÐÅÏ¢¹ÜÀíÆ÷ 
 */ 
public class SubscribeInfoManager { 
    private final ConcurrentHashMap<String/* group */, ConcurrentHashMap<String/* topic */, SubscriberInfo>> groupTopicSubcriberRegistry =
            new ConcurrentHashMap<String/* group */, ConcurrentHashMap<String, SubscriberInfo>>();
 
 
    public void subscribe(final String topic, final String group, final int maxSize,
            final MessageListener messageListener, final ConsumerMessageFilter consumerMessageFilter)
                    throws MetaClientException { 
        final ConcurrentHashMap<String, SubscriberInfo> topicSubsriberRegistry = this.getTopicSubscriberRegistry(group);
        SubscriberInfo info = topicSubsriberRegistry.get(topic);
        if (info == null) {
            info = new SubscriberInfo(messageListener, consumerMessageFilter, maxSize);
            final SubscriberInfo oldInfo = topicSubsriberRegistry.putIfAbsent(topic, info);
            if (oldInfo != null) {
                throw new MetaClientException("Topic=" + topic + " has been subscribered by group " + group);
            } 
        } 
        else {