public class GossipRouter extends ReceiverAdapter implements ConnectionListener
Modifier and Type | Class and Description |
---|---|
protected static class |
GossipRouter.Entry |
Modifier and Type | Field and Description |
---|---|
protected java.util.concurrent.ConcurrentMap<java.lang.String,java.util.concurrent.ConcurrentMap<Address,GossipRouter.Entry>> |
address_mappings |
protected int |
backlog |
protected java.lang.String |
bind_addr |
protected boolean |
emit_suspect_events |
protected long |
expiry_time |
protected boolean |
jmx |
protected long |
linger_timeout |
protected Log |
log |
protected int |
port |
protected java.util.concurrent.atomic.AtomicBoolean |
running |
protected BaseServer |
server |
protected long |
sock_read_timeout |
protected ThreadFactory |
thread_factory |
protected java.util.Timer |
timer |
protected boolean |
use_nio |
Constructor and Description |
---|
GossipRouter(java.lang.String bind_addr,
int local_port) |
Modifier and Type | Method and Description |
---|---|
protected void |
addAddressMapping(Address sender,
java.lang.String group,
Address addr,
PhysicalAddress phys_addr,
java.lang.String logical_name) |
int |
backlog() |
GossipRouter |
backlog(int backlog) |
java.lang.String |
bindAddress() |
GossipRouter |
bindAddress(java.lang.String addr) |
void |
connectionClosed(Connection conn,
java.lang.String reason) |
void |
connectionEstablished(Connection conn) |
java.lang.String |
dumpAddresssMappings() |
java.lang.String |
dumpRoutingTable() |
boolean |
emitSuspectEvents() |
GossipRouter |
emitSuspectEvents(boolean flag) |
long |
expiryTime() |
GossipRouter |
expiryTime(long t) |
protected void |
handleRegister(Address sender,
GossipData request) |
boolean |
jmx() |
GossipRouter |
jmx(boolean flag) |
long |
lingerTimeout() |
GossipRouter |
lingerTimeout(long t) |
Address |
localAddress() |
static void |
main(java.lang.String[] args) |
int |
port() |
GossipRouter |
port(int port) |
protected GossipData |
readRequest(ByteArrayDataInputStream in) |
void |
receive(Address sender,
byte[] buf,
int offset,
int length)
Delivers a message from a given sender to the application
|
protected void |
removeAddressMapping(java.lang.String group,
Address addr) |
protected void |
removeFromAddressMappings(Address client_addr) |
protected void |
route(java.lang.String group,
Address dest,
byte[] msg,
int offset,
int length) |
boolean |
running() |
protected void |
sendToAllMembersInGroup(java.util.Set<java.util.Map.Entry<Address,GossipRouter.Entry>> dests,
byte[] buf,
int offset,
int len) |
protected void |
sendToAllMembersInGroup(java.util.Set<java.util.Map.Entry<Address,GossipRouter.Entry>> dests,
GossipData request) |
protected void |
sendToMember(Address dest,
byte[] buf,
int offset,
int len) |
protected void |
sendToMember(Address dest,
GossipData request) |
long |
socketReadTimeout() |
GossipRouter |
socketReadTimeout(long t) |
void |
start()
Lifecycle operation.
|
void |
stop()
Always called before destroy().
|
ThreadFactory |
threadPoolFactory() |
GossipRouter |
threadPoolFactory(ThreadFactory f) |
boolean |
useNio() |
GossipRouter |
useNio(boolean flag) |
receive
protected java.lang.String bind_addr
protected int port
protected long expiry_time
protected long linger_timeout
protected long sock_read_timeout
protected ThreadFactory thread_factory
protected int backlog
protected boolean jmx
protected boolean use_nio
protected boolean emit_suspect_events
protected BaseServer server
protected final java.util.concurrent.atomic.AtomicBoolean running
protected java.util.Timer timer
protected final Log log
protected final java.util.concurrent.ConcurrentMap<java.lang.String,java.util.concurrent.ConcurrentMap<Address,GossipRouter.Entry>> address_mappings
public Address localAddress()
public java.lang.String bindAddress()
public GossipRouter bindAddress(java.lang.String addr)
public int port()
public GossipRouter port(int port)
public long expiryTime()
public GossipRouter expiryTime(long t)
public long lingerTimeout()
public GossipRouter lingerTimeout(long t)
public long socketReadTimeout()
public GossipRouter socketReadTimeout(long t)
public ThreadFactory threadPoolFactory()
public GossipRouter threadPoolFactory(ThreadFactory f)
public int backlog()
public GossipRouter backlog(int backlog)
public boolean jmx()
public GossipRouter jmx(boolean flag)
public boolean useNio()
public GossipRouter useNio(boolean flag)
public boolean emitSuspectEvents()
public GossipRouter emitSuspectEvents(boolean flag)
public boolean running()
public void start() throws java.lang.Exception
java.lang.Exception
public void stop()
public java.lang.String dumpRoutingTable()
public java.lang.String dumpAddresssMappings()
public void receive(Address sender, byte[] buf, int offset, int length)
Receiver
receive
in interface Receiver
receive
in class ReceiverAdapter
sender
- The sender of the messagebuf
- The buffer. An application typically de-serializes data from the buffer into objects used by the
application. Note that when receive() returns, it is not safe to use the buffer any longer;
if an application needs to use a buffer after this callback returns, it must make a copy.offset
- The offset at which the received data startslength
- The length of the received datapublic void connectionClosed(Connection conn, java.lang.String reason)
connectionClosed
in interface ConnectionListener
public void connectionEstablished(Connection conn)
connectionEstablished
in interface ConnectionListener
protected GossipData readRequest(ByteArrayDataInputStream in)
protected void handleRegister(Address sender, GossipData request)
protected void addAddressMapping(Address sender, java.lang.String group, Address addr, PhysicalAddress phys_addr, java.lang.String logical_name)
protected void removeAddressMapping(java.lang.String group, Address addr)
protected void removeFromAddressMappings(Address client_addr)
protected void route(java.lang.String group, Address dest, byte[] msg, int offset, int length)
protected void sendToAllMembersInGroup(java.util.Set<java.util.Map.Entry<Address,GossipRouter.Entry>> dests, GossipData request)
protected void sendToAllMembersInGroup(java.util.Set<java.util.Map.Entry<Address,GossipRouter.Entry>> dests, byte[] buf, int offset, int len)
protected void sendToMember(Address dest, GossipData request)
protected void sendToMember(Address dest, byte[] buf, int offset, int len)
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception
Copyright © 1998-2020 Red Hat. All Rights Reserved.