All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jgroups.blocks.cs.TcpBaseServer Maven / Gradle / Ivy

Go to download

This artifact provides a single jar that contains all classes required to use remote Jakarta Enterprise Beans and Jakarta Messaging, including all dependencies. It is intended for use by those not using maven, maven users should just import the Jakarta Enterprise Beans and Jakarta Messaging BOM's instead (shaded JAR's cause lots of problems with maven, as it is very easy to inadvertently end up with different versions on classes on the class path).

There is a newer version: 35.0.0.Final
Show newest version
package org.jgroups.blocks.cs;

import org.jgroups.Address;
import org.jgroups.util.DefaultSocketFactory;
import org.jgroups.util.SocketFactory;
import org.jgroups.util.ThreadFactory;

/**
 * Common base class for TCP based clients and servers
 * @author Bela Ban
 * @since  3.6.5
 */
public abstract class TcpBaseServer extends BaseServer {
    protected SocketFactory     socket_factory=new DefaultSocketFactory();
    protected volatile boolean  use_send_queues=true;
    protected int               send_queue_size=2000;
    protected int               peer_addr_read_timeout=2000; // max time in milliseconds to block on reading peer address

    protected TcpBaseServer(ThreadFactory f) {
        super(f);
    }

    @Override
    protected TcpConnection createConnection(Address dest) throws Exception {
        return new TcpConnection(dest, this);
    }


    public int           peerAddressReadTimeout()                {return peer_addr_read_timeout;}
    public TcpBaseServer peerAddressReadTimeout(int timeout)     {this.peer_addr_read_timeout=timeout; return this;}
    public int           sendQueueSize()                         {return send_queue_size;}
    public TcpBaseServer sendQueueSize(int send_queue_size)      {this.send_queue_size=send_queue_size; return this;}
    public boolean       useSendQueues()                         {return use_send_queues;}
    public TcpBaseServer useSendQueues(boolean flag)             {this.use_send_queues=flag; return this;}
    public SocketFactory socketFactory()                         {return socket_factory;}
    public TcpBaseServer socketFactory(SocketFactory factory)    {this.socket_factory=factory; return this;}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy