SessionManager.java
725 Bytes
package com.genersoft.iot.vmp.jt1078.server;
import io.netty.channel.Channel;
import java.util.HashMap;
import java.util.Map;
public final class SessionManager
{
private static final Map<String, Object> mappings = new HashMap<>();
public static void init()
{
// ...
}
public static <T> T get(Channel channel, String key)
{
return (T) mappings.get(channel.id().asLongText() + key);
}
public static void set(Channel channel, String key, Object value)
{
mappings.put(channel.id().asLongText() + key, value);
}
public static boolean contains(Channel channel, String key)
{
return mappings.containsKey(channel.id().asLongText() + key);
}
}