org.jgroups.stack
Class DiagnosticsHandler

java.lang.Object
  extended by org.jgroups.stack.DiagnosticsHandler
All Implemented Interfaces:
java.lang.Runnable

public class DiagnosticsHandler
extends java.lang.Object
implements java.lang.Runnable

Since:
3.0
Author:
Bela Ban

Nested Class Summary
static interface DiagnosticsHandler.ProbeHandler
           
 
Field Summary
protected  java.util.List<java.net.NetworkInterface> bind_interfaces
           
protected  java.net.MulticastSocket diag_sock
           
protected  java.net.InetAddress diagnostics_addr
           
protected  int diagnostics_port
           
protected  java.util.Set<DiagnosticsHandler.ProbeHandler> handlers
           
protected  Log log
           
protected  java.lang.String passcode
           
protected  SocketFactory socket_factory
           
protected  java.lang.Thread thread
           
protected  ThreadFactory thread_factory
           
static java.lang.String THREAD_NAME
           
protected  int ttl
           
 
Constructor Summary
DiagnosticsHandler(java.net.InetAddress diagnostics_addr, int diagnostics_port, java.util.List<java.net.NetworkInterface> bind_interfaces, int diagnostics_ttl, Log log, SocketFactory socket_factory, ThreadFactory thread_factory, java.lang.String passcode)
           
DiagnosticsHandler(java.net.InetAddress diagnostics_addr, int diagnostics_port, Log log, SocketFactory socket_factory, ThreadFactory thread_factory)
           
DiagnosticsHandler(java.net.InetAddress diagnostics_addr, int diagnostics_port, Log log, SocketFactory socket_factory, ThreadFactory thread_factory, java.lang.String passcode)
           
 
Method Summary
protected  int authorizeProbeRequest(java.net.DatagramPacket packet)
          Performs authorization on given DatagramPacket.
protected  void bindToInterfaces(java.util.List<java.net.NetworkInterface> interfaces, java.net.MulticastSocket s)
           
 java.util.Set<DiagnosticsHandler.ProbeHandler> getProbeHandlers()
           
 java.lang.Thread getThread()
           
protected  void handleDiagnosticProbe(java.net.SocketAddress sender, java.net.DatagramSocket sock, java.lang.String request)
           
protected  boolean isAuthorizationRequired()
           
 void registerProbeHandler(DiagnosticsHandler.ProbeHandler handler)
           
 void run()
           
protected static void sendResponse(java.net.DatagramSocket sock, java.net.SocketAddress sender, byte[] buf)
           
 void start()
           
 void stop()
           
 void unregisterProbeHandler(DiagnosticsHandler.ProbeHandler handler)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

THREAD_NAME

public static final java.lang.String THREAD_NAME
See Also:
Constant Field Values

thread

protected java.lang.Thread thread

diag_sock

protected java.net.MulticastSocket diag_sock

diagnostics_addr

protected java.net.InetAddress diagnostics_addr

diagnostics_port

protected int diagnostics_port

ttl

protected int ttl

bind_interfaces

protected java.util.List<java.net.NetworkInterface> bind_interfaces

handlers

protected final java.util.Set<DiagnosticsHandler.ProbeHandler> handlers

log

protected final Log log

socket_factory

protected final SocketFactory socket_factory

thread_factory

protected final ThreadFactory thread_factory

passcode

protected final java.lang.String passcode
Constructor Detail

DiagnosticsHandler

public DiagnosticsHandler(java.net.InetAddress diagnostics_addr,
                          int diagnostics_port,
                          Log log,
                          SocketFactory socket_factory,
                          ThreadFactory thread_factory)

DiagnosticsHandler

public DiagnosticsHandler(java.net.InetAddress diagnostics_addr,
                          int diagnostics_port,
                          Log log,
                          SocketFactory socket_factory,
                          ThreadFactory thread_factory,
                          java.lang.String passcode)

DiagnosticsHandler

public DiagnosticsHandler(java.net.InetAddress diagnostics_addr,
                          int diagnostics_port,
                          java.util.List<java.net.NetworkInterface> bind_interfaces,
                          int diagnostics_ttl,
                          Log log,
                          SocketFactory socket_factory,
                          ThreadFactory thread_factory,
                          java.lang.String passcode)
Method Detail

getThread

public java.lang.Thread getThread()

getProbeHandlers

public java.util.Set<DiagnosticsHandler.ProbeHandler> getProbeHandlers()

registerProbeHandler

public void registerProbeHandler(DiagnosticsHandler.ProbeHandler handler)

unregisterProbeHandler

public void unregisterProbeHandler(DiagnosticsHandler.ProbeHandler handler)

start

public void start()
           throws java.io.IOException
Throws:
java.io.IOException

stop

public void stop()

run

public void run()
Specified by:
run in interface java.lang.Runnable

handleDiagnosticProbe

protected void handleDiagnosticProbe(java.net.SocketAddress sender,
                                     java.net.DatagramSocket sock,
                                     java.lang.String request)

authorizeProbeRequest

protected int authorizeProbeRequest(java.net.DatagramPacket packet)
                             throws java.lang.Exception
Performs authorization on given DatagramPacket.

Parameters:
packet - to authorize
Returns:
offset in DatagramPacket where request payload starts
Throws:
java.lang.Exception - thrown if passcode received from client does not match set passcode

sendResponse

protected static void sendResponse(java.net.DatagramSocket sock,
                                   java.net.SocketAddress sender,
                                   byte[] buf)
                            throws java.io.IOException
Throws:
java.io.IOException

bindToInterfaces

protected void bindToInterfaces(java.util.List<java.net.NetworkInterface> interfaces,
                                java.net.MulticastSocket s)

isAuthorizationRequired

protected boolean isAuthorizationRequired()


Copyright © 1998-2012 Bela Ban / Red Hat. All Rights Reserved.