Class JCACommandThread

  • All Implemented Interfaces:
    Runnable

    public class JCACommandThread
    extends Thread
    JCA command pump, added for two reasons:
    1. JCA callbacks can't directly send JCA commands without danger of a deadlock, at least not with JNI and the "DirectRequestDispatcher".
    2. Instead of calling 'flushIO' after each command, this thread allows for a few requests to queue up, then periodically pumps them out with only a final 'flush'
    Version:
    Initial version:CSS, 4-Jun-2012, Luofeng Li:added codes to support for the new archiver
    Author:
    Kay Kasemir
    • Constructor Detail

      • JCACommandThread

        public JCACommandThread​(ConfigService configService)
        Construct, but don't start the thread.
        Parameters:
        configService - ConfigService
        See Also:
        start()
    • Method Detail

      • start

        public void start()
        Version of start that may be called multiple times.

        The thread must only be started after the first PV has been created. Otherwise, if flush is called without PVs, JNI JCA reports pthread errors.

        NOP when already running

        Overrides:
        start in class Thread
      • addCommand

        public void addCommand​(Runnable command)
        Add a command to the queue. add some cap on the command queue? At least for value updates?
        Parameters:
        command - Runnable
      • run

        public void run()
        Specified by:
        run in interface Runnable
        Overrides:
        run in class Thread