AppRepository.java 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. package com.its.vds.global;
  2. import com.its.vds.entity.TbVdsCtlr;
  3. import io.netty.channel.Channel;
  4. import lombok.Getter;
  5. import lombok.Setter;
  6. import lombok.extern.slf4j.Slf4j;
  7. import java.util.concurrent.ConcurrentHashMap;
  8. @Slf4j
  9. @Getter
  10. @Setter
  11. public class AppRepository {
  12. private static AppRepository _instance = null;
  13. public ConcurrentHashMap<String, TbVdsCtlr> ctlrMap = null;
  14. public ConcurrentHashMap<String, TbVdsCtlr> ctlrIpMap = null;
  15. public ConcurrentHashMap<String, TbVdsCtlr> ctlrKeyMap = null;
  16. public ConcurrentHashMap<Channel, TbVdsCtlr> ctlrChannelMap = null;
  17. public static AppRepository getInstance() {
  18. if (_instance == null) {
  19. synchronized (AppRepository.class) {
  20. if (_instance == null)
  21. _instance = new AppRepository();
  22. }
  23. }
  24. return _instance;
  25. }
  26. public AppRepository() {
  27. this.ctlrMap = new ConcurrentHashMap<>();
  28. this.ctlrIpMap = new ConcurrentHashMap<>();
  29. this.ctlrKeyMap = new ConcurrentHashMap<>();
  30. this.ctlrChannelMap = new ConcurrentHashMap<>();
  31. }
  32. }