예제 #1
0
  /**
   * Creates a new instance of JcaSystem
   *
   * @param contextName one of "com.cosylab.epics.caj.CAJContext",
   *     "gov.aps.jca.jni.ThreadSafeContext" or "gov.aps.jca.jni.SingleThreadedContext"
   */
  public JcaSystem(final String contextName) {
    try {
      JCA_LIBRARY = JCALibrary.getInstance();

      final String contextType = (contextName != null) ? contextName : defaultJCAContextType();
      JCA_CONTEXT = JCA_LIBRARY.createContext(contextType);
    } catch (CAException exception) {
      exception.printStackTrace();
    }
  }
예제 #2
0
  /**
   * Initialize JCA context.
   *
   * @throws CAException throws on any failure.
   */
  private void initialize() throws CAException {

    // Get the JCALibrary instance.
    JCALibrary jca = JCALibrary.getInstance();

    // Create a context with default configuration values.
    context = jca.createContext(JCALibrary.JNI_THREAD_SAFE);

    // Display basic information about the context.
    System.out.println(context.getVersion().getVersionString());
    context.printInfo();
    System.out.println();
  }
  static {
    EpicsPlugin plugin = EpicsPlugin.getDefault();

    boolean use_pure_java = plugin.usePureJava();
    paramClassName = use_pure_java ? JCALibrary.CHANNEL_ACCESS_JAVA : JCALibrary.JNI_THREAD_SAFE;
    paramMask = plugin.getMonitorMask().getMask();
    dbePropertySupported = plugin.isDbePropertySupported();
    honorZeroPrecision = plugin.isHonorZeroPrecision();
    rtypValueOnly = plugin.isRtypValueOnly();
    varArraySupported = plugin.getVarArraySupported();
    log.config("Loading epics data source parameters: " + paramClassName + " - " + paramMask);
    JCALibrary jca = JCALibrary.getInstance();
    try {
      context = jca.createContext(paramClassName);
    } catch (CAException ex) {
      log.log(Level.SEVERE, "Couldn't create JCA context", ex);
    }
  }
  public LatestMonitorOnlyQueuedEventDispatcher() {
    _dispatcherThread = new Thread(this, "LatestMonitorOnlyQueuedEventDispatcher-" + (_count++));
    _dispatcherThread.setDaemon(true);
    setPriority(
        JCALibrary.getInstance()
            .getPropertyAsInt(
                LatestMonitorOnlyQueuedEventDispatcher.class.getName() + ".priority", _priority));
    _queue = new ArrayList();
    _queueLimit =
        JCALibrary.getInstance()
            .getPropertyAsInt(
                LatestMonitorOnlyQueuedEventDispatcher.class.getName() + ".queue_limit",
                _queueLimit);
    if (_queueLimit < 10) _queueLimit = 10;

    _sourcesEventCount = new HashMap();
    _limit =
        JCALibrary.getInstance()
            .getPropertyAsInt(
                LatestMonitorOnlyQueuedEventDispatcher.class.getName() + ".channel_queue_limit",
                _limit);
    if (_limit < 3) _limit = 3;

    _overrideMap = new HashMap();

    _monitorOutput =
        JCALibrary.getInstance()
            .getProperty(
                LatestMonitorOnlyQueuedEventDispatcher.class.getName() + ".monitor_output",
                _monitorOutput);
    if (_monitorOutput != null) {
      _monitorThread =
          new Thread(
              new Runnable() {
                public void run() {
                  runMonitoring();
                }
              },
              _dispatcherThread.getName() + " monitor");
      _monitorThread.start();
    }

    _dispatcherThread.start();
  }