Methods Summary |
---|
protected int | bind(java.net.ServerSocket socket, int portstart, int retries)recursive bind to find the next available port
InetSocketAddress addr = null;
while ( retries > 0 ) {
try {
addr = new InetSocketAddress(getBind(), portstart);
socket.bind(addr);
setPort(portstart);
log.info("Receiver Server Socket bound to:"+addr);
return 0;
}catch ( IOException x) {
retries--;
if ( retries <= 0 ) {
log.info("Unable to bind server socket to:"+addr+" throwing error.");
throw x;
}
portstart++;
try {Thread.sleep(25);}catch( InterruptedException ti){Thread.currentThread().interrupted();}
retries = bind(socket,portstart,retries);
}
}
return retries;
|
public boolean | doListen()
return listen;
|
public java.lang.String | getAddress()
getBind();
return this.host;
|
public int | getAutoBind()
return autoBind;
|
public java.net.InetAddress | getBind()
if (bind == null) {
try {
if ("auto".equals(host)) {
host = java.net.InetAddress.getLocalHost().getHostAddress();
}
if (log.isDebugEnabled())
log.debug("Starting replication listener on address:"+ host);
bind = java.net.InetAddress.getByName(host);
} catch (IOException ioe) {
log.error("Failed bind replication listener on address:"+ host, ioe);
}
}
return bind;
|
public boolean | getDirect()
return direct;
|
public java.util.concurrent.ExecutorService | getExecutor()
return executor;
|
public java.lang.String | getHost()
return getAddress();
|
public org.apache.catalina.tribes.MessageListener | getListener()
return listener;
|
public int | getMaxTasks()
return maxTasks;
|
public int | getMaxThreads()
return maxThreads;
|
public org.apache.catalina.tribes.MessageListener | getMessageListener()getMessageListener
return listener;
|
public int | getMinTasks()
return minTasks;
|
public int | getMinThreads()
return minThreads;
|
public boolean | getOoBInline()
return ooBInline;
|
public int | getPort()
return port;
|
public int | getRxBufSize()
return rxBufSize;
|
public int | getSecurePort()
return securePort;
|
public long | getSelectorTimeout()
return tcpSelectorTimeout;
|
public boolean | getSoKeepAlive()
return soKeepAlive;
|
public boolean | getSoLingerOn()
return soLingerOn;
|
public int | getSoLingerTime()
return soLingerTime;
|
public boolean | getSoReuseAddress()
return soReuseAddress;
|
public int | getSoTrafficClass()
return soTrafficClass;
|
public RxTaskPool | getTaskPool()
return pool;
|
public java.lang.String | getTcpListenAddress()
return getAddress();
|
public int | getTcpListenPort()
return getPort();
|
public boolean | getTcpNoDelay()
return tcpNoDelay;
|
public long | getTcpSelectorTimeout()
return getSelectorTimeout();
|
public int | getTcpThreadCount()
return getMaxThreads();
|
public int | getTimeout()
return timeout;
|
public int | getTxBufSize()
return txBufSize;
|
public boolean | getUseBufferPool()
return useBufferPool;
|
public int | getWorkerThreadOptions()
int options = 0;
if ( getDirect() ) options = options | OPTION_DIRECT_BUFFER;
return options;
|
public void | heartbeat()
//empty operation
|
public boolean | isListening()
return listen;
|
public void | messageDataReceived(org.apache.catalina.tribes.ChannelMessage data)
if ( this.listener != null ) {
if ( listener.accept(data) ) listener.messageReceived(data);
}
|
public void | setAddress(java.lang.String host)
this.host = host;
|
public void | setAutoBind(int autoBind)
this.autoBind = autoBind;
if ( this.autoBind <= 0 ) this.autoBind = 1;
|
public void | setBind(java.net.InetAddress bind)
this.bind = bind;
|
public void | setDirect(boolean direct)
this.direct = direct;
|
public void | setExecutor(java.util.concurrent.ExecutorService executor)
this.executor = executor;
|
public void | setHost(java.lang.String host)
setAddress(host);
|
public void | setListen(boolean doListen)
this.listen = doListen;
|
public void | setListener(org.apache.catalina.tribes.MessageListener listener)
this.listener = listener;
|
public void | setLog(org.apache.juli.logging.Log log)
this.log = log;
|
public void | setMaxTasks(int maxTasks)
this.maxTasks = maxTasks;
|
public void | setMaxThreads(int maxThreads)
this.maxThreads = maxThreads;
|
public void | setMessageListener(org.apache.catalina.tribes.MessageListener listener)setMessageListener
this.listener = listener;
|
public void | setMinTasks(int minTasks)
this.minTasks = minTasks;
|
public void | setMinThreads(int minThreads)
this.minThreads = minThreads;
|
public void | setOoBInline(boolean ooBInline)
this.ooBInline = ooBInline;
|
public void | setPool(RxTaskPool pool)
this.pool = pool;
|
public void | setPort(int port)
this.port = port;
|
public void | setRxBufSize(int rxBufSize)
this.rxBufSize = rxBufSize;
|
public void | setSecurePort(int securePort)
this.securePort = securePort;
|
public void | setSelectorTimeout(long selTimeout)
tcpSelectorTimeout = selTimeout;
|
public void | setSoKeepAlive(boolean soKeepAlive)
this.soKeepAlive = soKeepAlive;
|
public void | setSoLingerOn(boolean soLingerOn)
this.soLingerOn = soLingerOn;
|
public void | setSoLingerTime(int soLingerTime)
this.soLingerTime = soLingerTime;
|
public void | setSoReuseAddress(boolean soReuseAddress)
this.soReuseAddress = soReuseAddress;
|
public void | setSoTrafficClass(int soTrafficClass)
this.soTrafficClass = soTrafficClass;
|
public void | setTcpListenAddress(java.lang.String tcpListenHost)
setAddress(tcpListenHost);
|
public void | setTcpListenPort(int tcpListenPort)
setPort(tcpListenPort);
|
public void | setTcpNoDelay(boolean tcpNoDelay)
this.tcpNoDelay = tcpNoDelay;
|
public void | setTcpSelectorTimeout(long selTimeout)
setSelectorTimeout(selTimeout);
|
public void | setTcpThreadCount(int tcpThreadCount)
setMaxThreads(tcpThreadCount);
setMinThreads(tcpThreadCount);
|
public void | setTimeout(int timeout)
this.timeout = timeout;
|
public void | setTxBufSize(int txBufSize)
this.txBufSize = txBufSize;
|
public void | setUseBufferPool(boolean useBufferPool)
this.useBufferPool = useBufferPool;
|
public void | start()
if ( executor == null ) {
executor = new ThreadPoolExecutor(minThreads,maxThreads,60,TimeUnit.SECONDS,new LinkedBlockingQueue<Runnable>());
}
|
public void | stop()
if ( executor != null ) executor.shutdownNow();//ignore left overs
executor = null;
|