Example #1
0
  /**
   * Constructor. The properties specifies how the connector should be configured. The properties to
   * include are;
   *
   * <p>'network_password' -> (String) the network password 'output_net_interface' ->
   * (NetworkInterface) the output network interface to use for IPv6 scope.
   */
  TCPNetworkConnector(TCPConnectorValues properties) {

    // Security check,
    SecurityManager security = System.getSecurityManager();
    if (security != null) security.checkPermission(MckoiNetworkPermission.CREATE_TCP_CONNECTOR);

    connection_pool = new HashMap<>();
    this.password = properties.getNetworkPassword();
    this.network_interface = properties.getOutputNetworkInterface();

    // This thread kills connections that have timed out.
    background_thread = new ConnectionDestroyThread(log, connection_pool);
    background_thread.setDaemon(true);
    background_thread.start();
  }
Example #2
0
 @Override
 public void stop() {
   background_thread.stopConnectionDestroy();
 }
Example #3
0
 @Override
 public void finalize() throws Throwable {
   background_thread.stopConnectionDestroy();
   super.finalize();
 }