public class GossipRouter
extends java.lang.Object
This class is especially interesting for applets which cannot directly make connections (neither UDP nor TCP) to a host different from the one they were loaded from. Therefore, an applet would create a normal channel plus protocol stack, but the bottom layer would have to be the TCP layer which sends all packets point-to-point (over a TCP connection) to the router, which in turn forwards them to their end location(s) (also over TCP). A centralized router would therefore have to be running on the host the applet was loaded from.
An alternative for running JGroups in an applet (IP multicast is not allows in applets as of 1.2), is to use point-to-point UDP communication via the gossip server. However, then the appplet has to be signed which involves additional administrative effort on the part of the user.
Modifier and Type | Field | Description |
---|---|---|
static byte |
CONNECT |
|
protected ThreadFactory |
default_thread_factory |
|
static byte |
DISCONNECT |
|
static byte |
DUMP |
|
static long |
EXPIRY_TIME |
|
static byte |
GET_RSP |
|
static byte |
GOSSIP_GET |
|
static long |
GOSSIP_REQUEST_TIMEOUT |
|
protected org.apache.commons.logging.Log |
log |
|
static int |
PORT |
|
static byte |
REGISTER |
|
static byte |
ROUTER_GET |
|
static long |
ROUTING_CLIENT_REPLY_TIMEOUT |
|
static byte |
SHUTDOWN |
|
protected java.util.concurrent.ExecutorService |
thread_pool |
|
protected boolean |
thread_pool_enabled |
|
protected long |
thread_pool_keep_alive_time |
|
protected int |
thread_pool_max_threads |
|
protected int |
thread_pool_min_threads |
|
protected java.util.concurrent.BlockingQueue<java.lang.Runnable> |
thread_pool_queue |
|
protected boolean |
thread_pool_queue_enabled |
|
protected int |
thread_pool_queue_max_size |
|
protected java.lang.String |
thread_pool_rejection_policy |
|
protected java.util.Timer |
timer |
|
static byte |
UNREGISTER |
Constructor | Description |
---|---|
GossipRouter() |
|
GossipRouter(int port) |
|
GossipRouter(int port,
java.lang.String bindAddressString) |
|
GossipRouter(int port,
java.lang.String bindAddressString,
long expiryTime) |
|
GossipRouter(int port,
java.lang.String bindAddressString,
long expiryTime,
long gossipRequestTimeout,
long routingClientReplyTimeout) |
Creates a gossip router on a given port bound to a specified interface
and an expiry time (in msecs) until a cached 'gossip' member entry
expires.
|
Modifier and Type | Method | Description |
---|---|---|
void |
create() |
JBoss MBean lifecycle operation.
|
protected java.util.concurrent.ExecutorService |
createThreadPool(int min_threads,
int max_threads,
long keep_alive_time,
java.lang.String rejection_policy,
java.util.concurrent.BlockingQueue<java.lang.Runnable> queue,
ThreadFactory factory) |
|
void |
destroy() |
JBoss MBean lifecycle operation.
|
java.lang.String |
dumpRoutingTable() |
|
int |
getBacklog() |
|
java.lang.String |
getBindAddress() |
|
ThreadFactory |
getDefaultThreadPoolThreadFactory() |
|
long |
getExpiryTime() |
|
long |
getGossipRequestTimeout() |
Deprecated.
|
long |
getLingerTimeout() |
|
int |
getPort() |
|
long |
getRoutingClientReplyTimeout() |
Deprecated.
|
long |
getSocketReadTimeout() |
|
long |
getThreadPoolKeepAliveTime() |
|
int |
getThreadPoolMaxThreads() |
|
int |
getThreadPoolMinThreads() |
|
int |
getThreadPoolQueueMaxSize() |
|
java.lang.String |
getThreadPoolRejectionPolicy() |
|
boolean |
isDiscardLoopbacks() |
|
boolean |
isStarted() |
|
boolean |
isThreadPoolEnabled() |
|
boolean |
isThreadPoolQueueEnabled() |
|
static void |
main(java.lang.String[] args) |
|
void |
setBacklog(int backlog) |
|
void |
setBindAddress(java.lang.String bindAddress) |
|
void |
setDefaultThreadPoolThreadFactory(ThreadFactory factory) |
|
void |
setDiscardLoopbacks(boolean discard_loopbacks) |
|
void |
setExpiryTime(long expiryTime) |
|
void |
setGossipRequestTimeout(long gossipRequestTimeout) |
Deprecated.
|
void |
setLingerTimeout(long linger_timeout) |
|
void |
setPort(int port) |
|
void |
setRoutingClientReplyTimeout(long routingClientReplyTimeout) |
Deprecated.
|
void |
setSocketReadTimeout(long sock_read_timeout) |
|
void |
setThreadPoolEnabled(boolean thread_pool_enabled) |
|
void |
setThreadPoolKeepAliveTime(long thread_pool_keep_alive_time) |
|
void |
setThreadPoolMaxThreads(int thread_pool_max_threads) |
|
void |
setThreadPoolMinThreads(int thread_pool_min_threads) |
|
void |
setThreadPoolQueueEnabled(boolean thread_pool_queue_enabled) |
|
void |
setThreadPoolQueueMaxSize(int thread_pool_queue_max_size) |
|
void |
setThreadPoolRejectionPolicy(java.lang.String thread_pool_rejection_policy) |
|
void |
start() |
JBoss MBean lifecycle operation.
|
void |
stop() |
JBoss MBean lifecycle operation.
|
static java.lang.String |
type2String(int type) |
public static final byte CONNECT
public static final byte DISCONNECT
public static final byte REGISTER
public static final byte GOSSIP_GET
public static final byte ROUTER_GET
public static final byte GET_RSP
public static final byte UNREGISTER
public static final byte DUMP
public static final byte SHUTDOWN
public static final int PORT
public static final long EXPIRY_TIME
public static final long GOSSIP_REQUEST_TIMEOUT
public static final long ROUTING_CLIENT_REPLY_TIMEOUT
protected int thread_pool_min_threads
protected int thread_pool_max_threads
protected long thread_pool_keep_alive_time
protected boolean thread_pool_enabled
protected boolean thread_pool_queue_enabled
protected int thread_pool_queue_max_size
protected java.lang.String thread_pool_rejection_policy
protected java.util.concurrent.ExecutorService thread_pool
protected java.util.concurrent.BlockingQueue<java.lang.Runnable> thread_pool_queue
protected ThreadFactory default_thread_factory
protected java.util.Timer timer
protected final org.apache.commons.logging.Log log
public GossipRouter()
public GossipRouter(int port)
public GossipRouter(int port, java.lang.String bindAddressString)
public GossipRouter(int port, java.lang.String bindAddressString, long expiryTime)
public GossipRouter(int port, java.lang.String bindAddressString, long expiryTime, long gossipRequestTimeout, long routingClientReplyTimeout)
Remaining two parameters are deprecated and not used.
port
- bindAddressString
- expiryTime
- gossipRequestTimeout
- routingClientReplyTimeout
- public void setPort(int port)
public int getPort()
public void setBindAddress(java.lang.String bindAddress)
public java.lang.String getBindAddress()
public int getBacklog()
public void setBacklog(int backlog)
public void setExpiryTime(long expiryTime)
public long getExpiryTime()
@Deprecated public void setGossipRequestTimeout(long gossipRequestTimeout)
@Deprecated public long getGossipRequestTimeout()
@Deprecated public void setRoutingClientReplyTimeout(long routingClientReplyTimeout)
@Deprecated public long getRoutingClientReplyTimeout()
public boolean isStarted()
public boolean isDiscardLoopbacks()
public void setDiscardLoopbacks(boolean discard_loopbacks)
public long getLingerTimeout()
public void setLingerTimeout(long linger_timeout)
public long getSocketReadTimeout()
public void setSocketReadTimeout(long sock_read_timeout)
public ThreadFactory getDefaultThreadPoolThreadFactory()
public void setDefaultThreadPoolThreadFactory(ThreadFactory factory)
public int getThreadPoolMinThreads()
public void setThreadPoolMinThreads(int thread_pool_min_threads)
public int getThreadPoolMaxThreads()
public void setThreadPoolMaxThreads(int thread_pool_max_threads)
public long getThreadPoolKeepAliveTime()
public void setThreadPoolKeepAliveTime(long thread_pool_keep_alive_time)
public boolean isThreadPoolEnabled()
public void setThreadPoolEnabled(boolean thread_pool_enabled)
public boolean isThreadPoolQueueEnabled()
public void setThreadPoolQueueEnabled(boolean thread_pool_queue_enabled)
public int getThreadPoolQueueMaxSize()
public void setThreadPoolQueueMaxSize(int thread_pool_queue_max_size)
public java.lang.String getThreadPoolRejectionPolicy()
public void setThreadPoolRejectionPolicy(java.lang.String thread_pool_rejection_policy)
public static java.lang.String type2String(int type)
public void create() throws java.lang.Exception
java.lang.Exception
public void start() throws java.lang.Exception
java.lang.Exception
public void stop()
public void destroy()
public java.lang.String dumpRoutingTable()
protected java.util.concurrent.ExecutorService createThreadPool(int min_threads, int max_threads, long keep_alive_time, java.lang.String rejection_policy, java.util.concurrent.BlockingQueue<java.lang.Runnable> queue, ThreadFactory factory)
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception
Copyright ? 1998-2008 Bela Ban. All Rights Reserved.