All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.healthy.common.websocket.holder.JsonMessageHandlerHolder Maven / Gradle / Ivy

There is a newer version: 2.0.0-M1
Show newest version
package com.healthy.common.websocket.holder;

import com.healthy.common.websocket.handler.JsonMessageHandler;
import com.healthy.common.websocket.message.JsonWebSocketMessage;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * JsonMessageHandlerHolder
 *
 * @author xm.z
 */
public final class JsonMessageHandlerHolder {

	private static final Map> MESSAGE_HANDLER_MAP = new ConcurrentHashMap<>();

	private JsonMessageHandlerHolder() {
	}

	public static JsonMessageHandler getHandler(String type) {
		return MESSAGE_HANDLER_MAP.get(type);
	}

	public static void addHandler(JsonMessageHandler jsonMessageHandler) {
		MESSAGE_HANDLER_MAP.put(jsonMessageHandler.type(), jsonMessageHandler);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy