Package org.jgroups.stack
Class DiagnosticsHandler
java.lang.Object
org.jgroups.blocks.cs.ReceiverAdapter
org.jgroups.stack.DiagnosticsHandler
- All Implemented Interfaces:
Closeable,AutoCloseable,Receiver
- Since:
- 3.0
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected InetAddressprotected List<NetworkInterface> protected booleanprotected booleanprotected booleanprotected final Set<DiagnosticsHandler.ProbeHandler> protected final Logprotected InetAddressprotected Stringprotected intprotected intprotected final SocketFactoryprotected ServerSocketprotected Runnerstatic final Stringprotected final ThreadFactoryprotected intprotected MulticastSocketprotected final BiConsumer<SocketAddress, String> protected Runnerstatic final Stringprotected DatagramSocket -
Constructor Summary
ConstructorsConstructorDescriptionConstructor used for standalone apps (without a JGroups stack)DiagnosticsHandler(Log log, SocketFactory socket_factory, ThreadFactory thread_factory) -
Method Summary
Modifier and TypeMethodDescriptionprotected intauthorizeProbeRequest(byte[] request) Performs authorization on given byte arrayprotected voidbindToInterfaces(List<NetworkInterface> interfaces, MulticastSocket s) voidclose()enableTcp(boolean f) enableUdp(boolean f) Returns the local datagram socket address (UDP) or the srv address (TCP)intgetPort()intintgetTtl()protected voidhandleDiagnosticProbe(SocketAddress sender, String request, BiConsumer<SocketAddress, String> rsp_sender) protected static booleanisCompatible(InetAddress addr, List<InterfaceAddress> addrs) Checks if there's any address in the address list that's compatible (same address family) to addrbooleanbooleanprotected voidrunTCP()protected voidrunUDP()protected voidsendResponse(DatagramSocket sock, SocketAddress sender, byte[] buf) setEnabled(boolean f) setPort(int p) setPortRange(int r) setTtl(int d) start()protected DiagnosticsHandlerstartTCP()protected DiagnosticsHandlerstartUDP()stop()booleanbooleanMethods inherited from class org.jgroups.blocks.cs.ReceiverAdapter
receive
-
Field Details
-
UDP_THREAD_NAME
- See Also:
-
TCP_THREAD_NAME
- See Also:
-
enabled
protected boolean enabled -
enable_udp
protected volatile boolean enable_udp -
enable_tcp
protected volatile boolean enable_tcp -
mcast_addr
-
port
protected int port -
bind_addr
-
port_range
protected int port_range -
ttl
protected int ttl -
bind_interfaces
-
passcode
-
srv_sock
-
udp_runner
-
tcp_runner
-
udp_mcast_sock
-
udp_ucast_sock
-
handlers
-
log
-
socket_factory
-
thread_factory
-
print_headers
-
same_cluster
-
udp_response_sender
-
-
Constructor Details
-
DiagnosticsHandler
Constructor used for standalone apps (without a JGroups stack)- Throws:
Exception
-
DiagnosticsHandler
-
-
Method Details
-
printHeaders
-
sameCluster
-
isEnabled
public boolean isEnabled() -
setEnabled
-
setMcastAddress
-
getMcastAddress
-
setBindAddress
-
getBindAddress
-
udpEnabled
public boolean udpEnabled() -
enableUdp
-
tcpEnabled
public boolean tcpEnabled() -
enableTcp
-
getPort
public int getPort() -
setPort
-
getPortRange
public int getPortRange() -
setPortRange
-
getTtl
public int getTtl() -
setTtl
-
getPasscode
-
setPasscode
-
getBindInterfaces
-
setBindInterfaces
-
setThreadNames
-
unsetThreadNames
-
getProbeHandlers
-
registerProbeHandler
-
unregisterProbeHandler
-
start
- Throws:
Exception
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
stop
-
isRunning
public boolean isRunning() -
getLocalAddress
Returns the local datagram socket address (UDP) or the srv address (TCP) -
runUDP
protected void runUDP() -
runTCP
protected void runTCP() -
startUDP
- Throws:
Exception
-
startTCP
- Throws:
Exception
-
handleDiagnosticProbe
protected void handleDiagnosticProbe(SocketAddress sender, String request, BiConsumer<SocketAddress, String> rsp_sender) -
authorizeProbeRequest
Performs authorization on given byte array- Parameters:
request- to authorize- Returns:
- offset in DatagramPacket where request payload starts
- Throws:
Exception- thrown if passcode received from client does not match set passcode
-
sendResponse
-
bindToInterfaces
-
isCompatible
Checks if there's any address in the address list that's compatible (same address family) to addr
-