Class EntityHandler


  • public class EntityHandler
    extends java.lang.Object
    Manages transfer entities on behalf of peer connections. Each entity handler has a global pool which manages all connections by default. Connections can also be "upgraded" to a higher connection control level, i.e. each connection has its own specialized entity for performance purposes.
    • Field Detail

      • upgraded_connections

        private final java.util.HashMap upgraded_connections
      • global_registered

        private boolean global_registered
      • handler_type

        private final int handler_type
    • Constructor Detail

      • EntityHandler

        public EntityHandler​(NetworkManager _net_man,
                             int type,
                             RateHandler rate_handler)
        Create a new entity handler using the given rate handler.
        Parameters:
        type - read or write type handler
        rate_handler - global max rate handler
    • Method Detail

      • registerPeerConnection

        public void registerPeerConnection​(NetworkConnectionBase connection)
        Register a peer connection for management by the handler.
        Parameters:
        connection - to add to the global pool
      • cancelPeerConnection

        public boolean cancelPeerConnection​(NetworkConnectionBase connection)
        Remove a peer connection from the entity handler.
        Parameters:
        connection - to cancel
      • upgradePeerConnection

        public void upgradePeerConnection​(NetworkConnectionBase connection,
                                          RateHandler handler,
                                          int partition_id)
        Upgrade a peer connection from the general pool to its own high-speed entity.
        Parameters:
        connection - to upgrade from global management
        handler - individual connection rate handler
      • downgradePeerConnection

        public void downgradePeerConnection​(NetworkConnectionBase connection)
        Downgrade (return) a peer connection back into the general pool.
        Parameters:
        connection - to downgrade back into the global entity