Class CARepeater

  • All Implemented Interfaces:
    java.lang.Runnable

    public class CARepeater
    extends java.lang.Object
    implements java.lang.Runnable
    CA repeater.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  CARepeater.JNIRepeater  
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String CA_DISABLE_REPEATER
      System JVM property key to disable CA repeater.
      static java.lang.String CA_FORCE_NATIVE_REPEATER
      System JVM property key to force native repeater.
      protected java.util.List<org.epics.ca.impl.repeater.CARepeater.Client> clients
      List of registered clients.
      protected java.net.DatagramSocket localDatagramSocket
      Local unbounded DatagramSocket.
      protected int repeaterPort
      Repeater port.
    • Constructor Summary

      Constructors 
      Constructor Description
      CARepeater()
      Constructor.
      CARepeater​(int repeaterPort)
      Constructor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected static java.net.DatagramSocket createDatagramSocket()
      Constructs an unbound datagram socket.
      protected static java.net.DatagramSocket createDatagramSocket​(int port, boolean reuseAddress)
      Constructs a atagram socket bound to the wildcard address on defined port.
      protected void fanOut​(java.net.InetSocketAddress fromAddress, java.nio.ByteBuffer buffer)  
      protected static boolean isRepeaterRunning​(int repeaterPort)
      Check if repeater is running.
      static void main​(java.lang.String[] argv)
      Main entry-point.
      protected void process()
      Process UDP requests.
      protected void registerNewClient​(java.net.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 java.lang.String CA_FORCE_NATIVE_REPEATER
        System JVM property key to force native repeater.
        See Also:
        Constant Field Values
      • CA_DISABLE_REPEATER

        public static final java.lang.String CA_DISABLE_REPEATER
        System JVM property key to disable CA repeater.
        See Also:
        Constant Field Values
      • repeaterPort

        protected int repeaterPort
        Repeater port.
      • localDatagramSocket

        protected java.net.DatagramSocket localDatagramSocket
        Local unbounded DatagramSocket.
      • clients

        protected java.util.List<org.epics.ca.impl.repeater.CARepeater.Client> clients
        List of registered clients.
    • Constructor Detail

      • CARepeater

        public CARepeater()
        Constructor.
      • CARepeater

        public CARepeater​(int repeaterPort)
        Constructor.
        Parameters:
        repeaterPort - repeater port.
    • Method Detail

      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
        See Also:
        Runnable.run()
      • registerNewClient

        protected void registerNewClient​(java.net.InetSocketAddress clientAddress)
      • fanOut

        protected void fanOut​(java.net.InetSocketAddress fromAddress,
                              java.nio.ByteBuffer buffer)
      • verifyClients

        protected void verifyClients()
        Verify all the clients.
      • process

        protected void process()
        Process UDP requests.
      • createDatagramSocket

        protected static java.net.DatagramSocket createDatagramSocket()
                                                               throws java.net.SocketException
        Constructs an unbound datagram socket.
        Returns:
        default unbound datagram socket.
        Throws:
        java.net.SocketException - socket exception
      • createDatagramSocket

        protected static java.net.DatagramSocket createDatagramSocket​(int port,
                                                                      boolean reuseAddress)
                                                               throws java.net.SocketException
        Constructs a atagram socket bound to the wildcard address on defined port.
        Parameters:
        port - port
        reuseAddress - reuse address
        Returns:
        default bounded datagram socket.
        Throws:
        java.net.SocketException - socket exception
      • 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 java.lang.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:
        java.lang.Throwable - throwable
      • main

        public static void main​(java.lang.String[] argv)
        Main entry-point.
        Parameters:
        argv - arguments.