Search in sources :

Example 1 with TcpServer

use of org.jgroups.blocks.cs.TcpServer in project JGroups by belaban.

the class TCP method start.

public void start() throws Exception {
    server = new TcpServer(getThreadFactory(), getSocketFactory(), bind_addr, bind_port, bind_port + port_range, external_addr, external_port);
    server.receiver(this).timeService(time_service).receiveBufferSize(recv_buf_size).sendBufferSize(send_buf_size).socketConnectionTimeout(sock_conn_timeout).tcpNodelay(tcp_nodelay).linger(linger).clientBindAddress(client_bind_addr).clientBindPort(client_bind_port).deferClientBinding(defer_client_bind_addr).log(this.log);
    server.setBufferedInputStreamSize(buffered_input_stream_size).setBufferedOutputStreamSize(buffered_output_stream_size).peerAddressReadTimeout(peer_addr_read_timeout).usePeerConnections(true).socketFactory(getSocketFactory());
    if (reaper_interval > 0 || conn_expire_time > 0) {
        if (reaper_interval == 0) {
            reaper_interval = 5000;
            log.warn("reaper_interval was 0, set it to %d", reaper_interval);
        }
        if (conn_expire_time == 0) {
            conn_expire_time = (long) 1000 * 60 * 5;
            log.warn("conn_expire_time was 0, set it to %d", conn_expire_time);
        }
        server.connExpireTimeout(conn_expire_time).reaperInterval(reaper_interval);
    }
    // we first start threads in TP (http://jira.jboss.com/jira/browse/JGRP-626)
    super.start();
}
Also used : TcpServer(org.jgroups.blocks.cs.TcpServer)

Example 2 with TcpServer

use of org.jgroups.blocks.cs.TcpServer in project JGroups by belaban.

the class ServerUnitTest method create.

protected static BaseServer create(boolean nio, int port) {
    try {
        BaseServer retval = nio ? new NioServer(bind_addr, port).maxSendBuffers(1024) : new TcpServer(bind_addr, port);
        retval.usePeerConnections(true);
        retval.start();
        return retval;
    } catch (Exception ex) {
        return null;
    }
}
Also used : BaseServer(org.jgroups.blocks.cs.BaseServer) NioServer(org.jgroups.blocks.cs.NioServer) TcpServer(org.jgroups.blocks.cs.TcpServer) UnknownHostException(java.net.UnknownHostException)

Aggregations

TcpServer (org.jgroups.blocks.cs.TcpServer)2 UnknownHostException (java.net.UnknownHostException)1 BaseServer (org.jgroups.blocks.cs.BaseServer)1 NioServer (org.jgroups.blocks.cs.NioServer)1