public TCPConnectionMap( String service_name, ThreadFactory f, SocketFactory socket_factory, Receiver r, InetAddress bind_addr, InetAddress external_addr, int srv_port, int max_port, long reaper_interval, long conn_expire_time) throws Exception { this.mapper = new Mapper(f, reaper_interval); this.receiver = r; this.bind_addr = bind_addr; this.conn_expire_time = conn_expire_time; if (socket_factory != null) this.socket_factory = socket_factory; this.srv_sock = Util.createServerSocket(this.socket_factory, service_name, bind_addr, srv_port, max_port); if (external_addr != null) local_addr = new IpAddress(external_addr, srv_sock.getLocalPort()); else if (bind_addr != null) local_addr = new IpAddress(bind_addr, srv_sock.getLocalPort()); else local_addr = new IpAddress(srv_sock.getLocalPort()); acceptor = f.newThread(thread_group, new ConnectionAcceptor(), "ConnectionMap.Acceptor"); }
public Sender(ThreadFactory tf, int send_queue_size) { this.runner = tf.newThread(this, "Connection.Sender [" + getSockAddress() + "]"); this.send_queue = new LinkedBlockingQueue<byte[]>(send_queue_size); }
public ConnectionPeerReceiver(ThreadFactory f) { recv = f.newThread(this, "Connection.Receiver [" + getSockAddress() + "]"); }