Package org.jgroups.stack
Class GossipClient
- java.lang.Object
-
- org.jgroups.stack.GossipClient
-
public class GossipClient extends java.lang.Object
Local stub for clients to access one (or more) GossipRouters. Will use proprietary protocol (using GossipData PDUs) based on TCP to connect to GossipRouter.Requires JDK >= 1.3 due to the use of Timer.
- Version:
- $Id: GossipClient.java,v 1.18.2.4 2008/10/31 08:21:14 belaban Exp $
- Author:
- Bela Ban Oct 4 2001
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.commons.logging.Log
log
-
Constructor Summary
Constructors Constructor Description GossipClient(java.util.Vector<IpAddress> gossip_hosts, long expiry)
Creates the GossipClientGossipClient(java.util.Vector<IpAddress> gossip_hosts, long expiry, int sock_conn_timeout)
GossipClient(IpAddress gossip_host, long expiry)
Creates the GossipClient
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addGossipRouter(IpAddress gossip_host)
Adds a GossipRouter to be accessed.void
destroy()
java.util.List<Address>
getMembers(java.lang.String group)
Returns all members of a given grouplong
getRefreshInterval()
int
getSocketConnectionTimeout()
int
getSocketReadTimeout()
boolean
isRefresherEnabled()
static void
main(java.lang.String[] args)
void
register(java.lang.String group, Address mbr)
Adds the member to the given group.void
setRefresherEnabled(boolean refresher_enabled)
void
setRefreshInterval(long refresh_interval)
void
setSocketConnectionTimeout(int sock_conn_timeout)
void
setSocketReadTimeout(int sock_read_timeout)
void
stop()
void
unregister(java.lang.String group, Address mbr)
-
-
-
Constructor Detail
-
GossipClient
public GossipClient(IpAddress gossip_host, long expiry)
Creates the GossipClient- Parameters:
gossip_host
- The address and port of the host on which the GossipRouter is runningexpiry
- Interval (in msecs) for the refresher task
-
GossipClient
public GossipClient(java.util.Vector<IpAddress> gossip_hosts, long expiry)
Creates the GossipClient- Parameters:
gossip_hosts
- List of IpAddressesexpiry
- Interval (in msecs) for the refresher task
-
GossipClient
public GossipClient(java.util.Vector<IpAddress> gossip_hosts, long expiry, int sock_conn_timeout)
-
-
Method Detail
-
isRefresherEnabled
public boolean isRefresherEnabled()
-
setRefresherEnabled
public void setRefresherEnabled(boolean refresher_enabled)
-
getSocketConnectionTimeout
public int getSocketConnectionTimeout()
-
setSocketConnectionTimeout
public void setSocketConnectionTimeout(int sock_conn_timeout)
-
getSocketReadTimeout
public int getSocketReadTimeout()
-
setSocketReadTimeout
public void setSocketReadTimeout(int sock_read_timeout)
-
getRefreshInterval
public long getRefreshInterval()
-
setRefreshInterval
public void setRefreshInterval(long refresh_interval)
-
stop
public void stop()
-
destroy
public void destroy()
-
addGossipRouter
public void addGossipRouter(IpAddress gossip_host)
Adds a GossipRouter to be accessed.
-
register
public void register(java.lang.String group, Address mbr)
Adds the member to the given group. If the group already has an entry for the member, its timestamp will be updated, preventing the cache cleaner from removing the entry.The entry will be registered with all GossipRouters that GossipClient is configured to access
-
unregister
public void unregister(java.lang.String group, Address mbr)
-
getMembers
public java.util.List<Address> getMembers(java.lang.String group)
Returns all members of a given group- Parameters:
group
- The group name- Returns:
- List A list of Addresses
-
main
public static void main(java.lang.String[] args)
-
-