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 EJB and JMS, including
all dependencies. It is intended for use by those not using maven, maven users should just import the EJB and
JMS 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).
package org.jgroups.blocks.cs;
import org.jgroups.Address;
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 int peer_addr_read_timeout=2000; // max time in milliseconds to block on reading peer address
protected int buffered_inputstream_size=8192;
protected int buffered_outputstream_size=8192;
protected TcpBaseServer(ThreadFactory f, SocketFactory sf, int recv_buf_size) {
super(f, sf, recv_buf_size);
}
@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 t) {this.peer_addr_read_timeout=t; return this;}
public int getBufferedInputStreamSize() {return buffered_inputstream_size;}
public TcpBaseServer setBufferedInputStreamSize(int s) {this.buffered_inputstream_size=s; return this;}
public int getBufferedOutputStreamSize() {return buffered_outputstream_size;}
public TcpBaseServer setBufferedOutputStreamSize(int s) {this.buffered_outputstream_size=s; return this;}
}