| | |
| | | |
| | | import com.zy.core.ThreadHandler; |
| | | import com.zy.core.enums.SlaveType; |
| | | import io.swagger.models.auth.In; |
| | | |
| | | import java.util.Map; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | |
| | | /** |
| | | * 线程缓存容器 |
| | | * Created by vincent on 2020/8/4 |
| | | */ |
| | | public class SlaveConnection { |
| | | |
| | | private static final String _LINK = "_"; |
| | | |
| | | private static Map<String, ThreadHandler> conContain = new ConcurrentHashMap<>(); |
| | | private static final Map<String, ThreadHandler> conContain = new ConcurrentHashMap<>(); |
| | | |
| | | public static void put(SlaveType type, Integer id, ThreadHandler threadHandler) { |
| | | String key = toKey(type, id); |
| | |
| | | conContain.put(key, threadHandler); |
| | | } |
| | | |
| | | public static ThreadHandler get(SlaveType type, Integer key) { |
| | | return conContain.get(toKey(type, key)); |
| | | public static ThreadHandler get(SlaveType type, Integer id) { |
| | | return conContain.get(toKey(type, id)); |
| | | } |
| | | |
| | | public static void remove(SlaveType type, Integer id) { |