类 ConnectionManager


  • @Service
    public class ConnectionManager
    extends java.lang.Object
    connect manager.
    版本:
    $Id: ConnectionManager.java, v 0.1 2020年07月13日 7:07 PM liuzunfei Exp $
    作者:
    liuzunfei
    • 字段详细资料

      • LOGGER

        private static final org.slf4j.Logger LOGGER
      • connectionForClientIp

        private java.util.Map<java.lang.String,​java.util.concurrent.atomic.AtomicInteger> connectionForClientIp
      • connections

        java.util.Map<java.lang.String,​Connection> connections
    • 方法详细资料

      • traced

        public boolean traced​(java.lang.String clientIp)
        if monitor detail.
        参数:
        clientIp - clientIp.
        返回:
      • checkValid

        public boolean checkValid​(java.lang.String connectionId)
        check connection id is valid.
        参数:
        connectionId - connectionId to be check.
        返回:
        is valid or not.
      • register

        public boolean register​(java.lang.String connectionId,
                                Connection connection)
        register a new connect.
        参数:
        connectionId - connectionId
        connection - connection
      • checkLimit

        private boolean checkLimit​(Connection connection)
      • unregister

        public void unregister​(java.lang.String connectionId)
        unregister a connection .
        参数:
        connectionId - connectionId.
      • getConnection

        public Connection getConnection​(java.lang.String connectionId)
        get by connection id.
        参数:
        connectionId - connection id.
        返回:
        connection of the id.
      • getConnectionByIp

        public java.util.List<Connection> getConnectionByIp​(java.lang.String clientIp)
        get by client ip.
        参数:
        clientIp - client ip.
        返回:
        connections of the client ip.
      • initConnectionEjector

        public void initConnectionEjector()
        init connection ejector.
      • getCurrentConnectionCount

        public int getCurrentConnectionCount()
        get current connections count.
        返回:
        get all connection count
      • refreshActiveTime

        public void refreshActiveTime​(java.lang.String connectionId)
        regresh connection active time.
        参数:
        connectionId - connectionId.
      • start

        @PostConstruct
        public void start()
        Start Task:Expel the connection which active Time expire.
      • loadCount

        public void loadCount​(int loadClient,
                              java.lang.String redirectAddress)
      • loadSingle

        public void loadSingle​(java.lang.String connectionId,
                               java.lang.String redirectAddress)
        send load request to spefic connetionId.
        参数:
        connectionId - connection id of client.
        redirectAddress - server address to redirect.
      • currentClientsCount

        public int currentClientsCount()
        get all client count.
        返回:
        client count.
      • currentClientsCount

        public int currentClientsCount​(java.util.Map<java.lang.String,​java.lang.String> filterLabels)
        get client count with labels filter.
        参数:
        filterLabels - label to filter client count.
        返回:
        count with the specific filter labels.
      • currentSdkClientCount

        public int currentSdkClientCount()
        get client count from sdk.
        返回:
        sdk client count.
      • currentClients

        public java.util.Map<java.lang.String,​Connection> currentClients()
      • getConnectionForClientIp

        public java.util.Map<java.lang.String,​java.util.concurrent.atomic.AtomicInteger> getConnectionForClientIp()