Package org.jgroups.stack
Class RouterStubManager
- java.lang.Object
-
- org.jgroups.stack.RouterStubManager
-
- All Implemented Interfaces:
java.lang.Runnable
,RouterStub.CloseListener
public class RouterStubManager extends java.lang.Object implements java.lang.Runnable, RouterStub.CloseListener
Manages a list of RouterStubs (e.g. health checking, reconnecting etc.- Author:
- Vladimir Blagojevic, Bela Ban
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
RouterStubManager.Target
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
cluster_name
protected long
interval
protected Address
local_addr
protected Log
log
protected java.lang.String
logical_name
protected Protocol
owner
protected PhysicalAddress
phys_addr
protected java.util.Set<RouterStubManager.Target>
reconnect_list
protected java.util.concurrent.Future<?>
reconnector_task
protected java.util.List<RouterStub>
stubs
protected TimeScheduler
timer
protected boolean
use_nio
-
Constructor Summary
Constructors Constructor Description RouterStubManager(Protocol owner, java.lang.String cluster_name, Address local_addr, java.lang.String logical_name, PhysicalAddress phys_addr, long interval)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
add(RouterStub stub)
protected boolean
add(RouterStubManager.Target target)
void
closed(RouterStub stub)
protected int
connectedStubs()
void
connectStubs()
RouterStub
createAndRegisterStub(IpAddress local, IpAddress router_addr)
void
destroyStubs()
void
disconnectStubs()
static RouterStubManager
emptyGossipClientStubManager(Protocol p)
protected RouterStub
find(IpAddress router_addr)
protected RouterStub
findRandomConnectedStub()
void
forAny(java.util.function.Consumer<RouterStub> action)
Applies action to a randomly picked RouterStub that's connectedvoid
forEach(java.util.function.Consumer<RouterStub> action)
Applies action to all RouterStubs that are connectedprotected void
moveStubToReconnects(RouterStub stub)
java.lang.String
print()
java.lang.String
printReconnectList()
java.lang.String
printStubs()
protected boolean
reconnect(RouterStubManager.Target target)
protected boolean
remove(RouterStub stub)
protected boolean
remove(RouterStubManager.Target target)
void
run()
RouterStubManager
socketFactory(SocketFactory socket_factory)
protected void
startReconnector()
protected void
stopReconnector()
RouterStub
unregisterStub(IpAddress router_addr)
RouterStubManager
useNio(boolean flag)
-
-
-
Field Detail
-
stubs
protected final java.util.List<RouterStub> stubs
-
reconnect_list
protected final java.util.Set<RouterStubManager.Target> reconnect_list
-
owner
protected final Protocol owner
-
timer
protected final TimeScheduler timer
-
cluster_name
protected final java.lang.String cluster_name
-
local_addr
protected final Address local_addr
-
logical_name
protected final java.lang.String logical_name
-
phys_addr
protected final PhysicalAddress phys_addr
-
interval
protected final long interval
-
use_nio
protected boolean use_nio
-
reconnector_task
protected java.util.concurrent.Future<?> reconnector_task
-
log
protected final Log log
-
-
Constructor Detail
-
RouterStubManager
public RouterStubManager(Protocol owner, java.lang.String cluster_name, Address local_addr, java.lang.String logical_name, PhysicalAddress phys_addr, long interval)
-
-
Method Detail
-
emptyGossipClientStubManager
public static RouterStubManager emptyGossipClientStubManager(Protocol p)
-
useNio
public RouterStubManager useNio(boolean flag)
-
forEach
public void forEach(java.util.function.Consumer<RouterStub> action)
Applies action to all RouterStubs that are connected- Parameters:
action
-
-
forAny
public void forAny(java.util.function.Consumer<RouterStub> action)
Applies action to a randomly picked RouterStub that's connected- Parameters:
action
-
-
createAndRegisterStub
public RouterStub createAndRegisterStub(IpAddress local, IpAddress router_addr)
-
unregisterStub
public RouterStub unregisterStub(IpAddress router_addr)
-
connectStubs
public void connectStubs()
-
disconnectStubs
public void disconnectStubs()
-
destroyStubs
public void destroyStubs()
-
printStubs
public java.lang.String printStubs()
-
printReconnectList
public java.lang.String printReconnectList()
-
print
public java.lang.String print()
-
run
public void run()
- Specified by:
run
in interfacejava.lang.Runnable
-
closed
public void closed(RouterStub stub)
- Specified by:
closed
in interfaceRouterStub.CloseListener
-
reconnect
protected boolean reconnect(RouterStubManager.Target target)
-
moveStubToReconnects
protected void moveStubToReconnects(RouterStub stub)
-
add
protected boolean add(RouterStub stub)
-
add
protected boolean add(RouterStubManager.Target target)
-
remove
protected boolean remove(RouterStub stub)
-
remove
protected boolean remove(RouterStubManager.Target target)
-
find
protected RouterStub find(IpAddress router_addr)
-
findRandomConnectedStub
protected RouterStub findRandomConnectedStub()
-
connectedStubs
protected int connectedStubs()
-
startReconnector
protected void startReconnector()
-
stopReconnector
protected void stopReconnector()
-
socketFactory
public RouterStubManager socketFactory(SocketFactory socket_factory)
-
-