com.cosylab.epics.caj
Class CARepeater

java.lang.Object
  extended by com.cosylab.epics.caj.CARepeater
All Implemented Interfaces:
Runnable

public class CARepeater
extends Object
implements Runnable

CA repeater.

Version:
$id$
Author:
Matej Sekoranja

Field Summary
static String CA_DISABLE_REPEATER
          System JVM property key to disable CA repeater.
static String CA_FORCE_NATIVE_REPEATER
          System JVM property key to force native repeater.
protected  List clients
          List of registered clients.
protected  DatagramSocket localDatagramSocket
          Local unbounded DatagramSocket.
protected  Logger logger
          Context logger.
protected  int repeaterPort
          Repeater port.
 
Constructor Summary
CARepeater()
          Constructor.
CARepeater(int repeaterPort)
          Constructor.
 
Method Summary
protected static DatagramSocket createDatagramSocket()
          Constructs an unbound datagram socket.
protected static DatagramSocket createDatagramSocket(int port, boolean reuseAddress)
          Constructs a atagram socket bound to the wildcard address on defined port.
protected  void fanOut(InetSocketAddress fromAddress, ByteBuffer buffer)
           
protected  void initialize()
          Initialize CA repeater.
protected  void initializeLogger()
          Initialize context logger.
protected static boolean isRepeaterRunning(int repeaterPort)
          Check if repeater is running.
static void main(String[] argv)
          Main entry-point.
protected  void process()
          Process UDP requests.
protected  void registerNewClient(InetSocketAddress clientAddress)
           
 void run()
           
static void startRepeater(int repeaterPort)
          Start repeater as detached process.
protected  void verifyClients()
          Verify all the clients.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CA_FORCE_NATIVE_REPEATER

public static final String CA_FORCE_NATIVE_REPEATER
System JVM property key to force native repeater.

See Also:
Constant Field Values

CA_DISABLE_REPEATER

public static final String CA_DISABLE_REPEATER
System JVM property key to disable CA repeater.

See Also:
Constant Field Values

logger

protected Logger logger
Context logger.


repeaterPort

protected int repeaterPort
Repeater port.


localDatagramSocket

protected DatagramSocket localDatagramSocket
Local unbounded DatagramSocket.


clients

protected List clients
List of registered clients.

Constructor Detail

CARepeater

public CARepeater()
Constructor.


CARepeater

public CARepeater(int repeaterPort)
Constructor.

Parameters:
repeaterPort - repeater port.
Method Detail

initialize

protected void initialize()
Initialize CA repeater.


initializeLogger

protected void initializeLogger()
Initialize context logger.


run

public void run()
Specified by:
run in interface Runnable
See Also:
Runnable.run()

registerNewClient

protected void registerNewClient(InetSocketAddress clientAddress)

fanOut

protected void fanOut(InetSocketAddress fromAddress,
                      ByteBuffer buffer)

verifyClients

protected void verifyClients()
Verify all the clients.


process

protected void process()
Process UDP requests.


createDatagramSocket

protected static DatagramSocket createDatagramSocket()
                                              throws SocketException
Constructs an unbound datagram socket.

Returns:
default unbound datagram socket.
Throws:
SocketException

createDatagramSocket

protected static DatagramSocket createDatagramSocket(int port,
                                                     boolean reuseAddress)
                                              throws SocketException
Constructs a atagram socket bound to the wildcard address on defined port.

Parameters:
port -
reuseAddress -
Returns:
default bounded datagram socket.
Throws:
SocketException

isRepeaterRunning

protected static boolean isRepeaterRunning(int repeaterPort)
Check if repeater is running.

Parameters:
repeaterPort - repeater port.
Returns:
true if repeater is already running, false otherwise

startRepeater

public static void startRepeater(int repeaterPort)
                          throws Throwable
Start repeater as detached process. First checks if repeater is already running, if not other JVM process is run.

Parameters:
repeaterPort - repeater port.
Throws:
Throwable

main

public static void main(String[] argv)
Main entry-point.

Parameters:
argv - arguments.


Copyright © 2004-2013 Cosylab. All Rights Reserved.