示例#1
0
 /**
  * * if this is a pv control other pvs, when this pv's value changes, it will stop or restart all
  * controlled pvs.
  *
  * @param ev
  * @throws Exception error when update all controlled pv's archiving status
  */
 private void updateAllControlPVEnablMent(MonitorEvent ev) throws Exception {
   final DBR dbr = ev.getDBR();
   boolean enable = DBR_Helper.decodeBooleanValue(dbr);
   ArrayList<String> copyOfControlledPVList = new ArrayList<String>(controlledPVList);
   if (enable) {
     enableAllPV = true;
     for (String pvName : copyOfControlledPVList) {
       logger.debug(pvName + " will be resumed");
       ArchiveEngine.resumeArchivingPV(pvName, configservice);
     }
   } else {
     enableAllPV = false;
     for (String pvName : copyOfControlledPVList) {
       logger.debug(pvName + " will be paused");
       ArchiveEngine.pauseArchivingPV(pvName, configservice);
     }
   }
 }
示例#2
0
 /** Subscribe for value updates. */
 private void subscribe() {
   synchronized (this) {
     // Prevent multiple subscriptions.
     if (subscription != null) {
       return;
     }
     // Late callback, channel already closed?
     final RefCountedChannel ch_ref = channel_ref;
     if (ch_ref == null) {
       return;
     }
     final Channel channel = ch_ref.getChannel();
     // final Logger logger = Activator.getLogger();
     try {
       if (channel.getConnectionState() != Channel.CONNECTED) {
         return;
       }
       //
       // the RefCountedChannel should maintain a single
       // subscription to the underlying CAJ/JCA channel.
       // So even with N PVs for the same channel, it's
       // only one subscription on the network instead of
       // N subscriptions.
       final DBRType type = DBR_Helper.getTimeType(plain, channel.getFieldType());
       state = PVConnectionState.Subscribing;
       totalMetaInfo.setStartTime(System.currentTimeMillis());
       // isnotTimestampDBR
       if (this.name.endsWith(".RTYP")) {
         subscription = channel.addMonitor(MonitorMask.ARCHIVE.getMask(), this);
       } else {
         subscription =
             channel.addMonitor(
                 type, channel.getElementCount(), MonitorMask.ARCHIVE.getMask(), this);
       }
     } catch (final Exception ex) {
       logger.error("exception when subscribing pv " + name, ex);
     }
   }
 }