Class EngineContext

java.lang.Object
org.epics.archiverappliance.engine.pv.EngineContext

public class EngineContext extends Object
the context for the Archiver Engine
Author:
Luofeng Li
  • Constructor Details

    • EngineContext

      public EngineContext(ConfigService configService) throws ConfigException
      This EngineContext should always be singleton
      Parameters:
      configService - the config service to initialize the engine context
      Throws:
      ConfigException
  • Method Details

    • getControlingPVList

      public ConcurrentHashMap<String,ControllingPV> getControlingPVList()
      Returns:
      the list of pvs controlling other pvs
    • recordWriteCycle

      public void recordWriteCycle(double wallClockSeconds, double totalChannelIOSeconds, int channelsWritten)
      Record the outcome of a completed write cycle.
      Parameters:
      wallClockSeconds - elapsed wall-clock seconds for the full cycle
      totalChannelIOSeconds - sum of per-channel I/O seconds across all channels written
      channelsWritten - number of channels that had data to write this cycle
    • recordSkippedWriteCycle

      public void recordSkippedWriteCycle()
      Record a write cycle that was skipped because the prior cycle was still running.
    • getAverageSecondsConsumedByWriter

      public double getAverageSecondsConsumedByWriter()
      Returns:
      average write-cycle wall-clock time in seconds
    • getAverageTotalChannelIOSeconds

      public double getAverageTotalChannelIOSeconds()
      Returns:
      average sum of per-channel I/O seconds per write cycle (equivalent sequential load)
    • getAverageChannelsWrittenPerCycle

      public double getAverageChannelsWrittenPerCycle()
      Returns:
      average number of channels written per write cycle
    • getSkippedWriteCycles

      public long getSkippedWriteCycles()
      Returns:
      total number of write cycles skipped due to backpressure
    • getWriteThreadCount

      public int getWriteThreadCount()
      Returns:
      Maximum concurrent channel writes per cycle; 0 means unlimited.
    • getJCACommandThread

      public JCACommandThread getJCACommandThread(int jcaCommandThreadId)
    • assignJCACommandThread

      public int assignJCACommandThread(String pvName, String iocHostName)
      Use this to assign JCA command threads to PV's
      Parameters:
      pvName - The name of PV
      iocHostName - Note this can and will often be null.
      Returns:
      threadId  
    • doesChannelContextMatchThreadContext

      public boolean doesChannelContextMatchThreadContext(gov.aps.jca.Channel channel, int jcaCommandThreadId)
    • getChannelList

      public ConcurrentHashMap<String,ArchiveChannel> getChannelList()
      Returns:
      the channel list of pvs, without the pvs for meta fields
    • getScheduler

      public ScheduledThreadPoolExecutor getScheduler()
      Returns:
      the scheduler for the whole engine
    • getScanScheduler

      public ScheduledThreadPoolExecutor getScanScheduler()
      Get the scheduler used for SCAN PV's
      Returns:
      scanScheduler  
    • getWriteThead

      public WriterRunnable getWriteThead()
      Returns:
      the WriterRunnable for the engines
    • startWriteThread

      public void startWriteThread(ConfigService configservice)
      start the write thread of the engine and this is actually called by the first pv when creating channel
      Parameters:
      configservice - configservice used by this writer
    • getWritePeriod

      public double getWritePeriod()
      Returns:
      the writing period in second
    • isWriteThreadStarted

      public boolean isWriteThreadStarted()
      Returns:
      the status of the writing thread. return true, if it is started.Otherwise, return false;
    • computeMetaInfo

      public void computeMetaInfo(PubSubEvent pubSubEvent)
    • pvTypeInfoChanged

      public void pvTypeInfoChanged(PVTypeInfoEvent event)
    • setDisconnectCheckTimeoutInSecondsForTestingPurposesOnly

      public void setDisconnectCheckTimeoutInSecondsForTestingPurposesOnly(int newDisconnectCheckTimeoutSeconds)
      Parameters:
      newDisconnectCheckTimeoutSeconds - This is to be used only for unit testing purposes... There are no guarantees that using this on a running server will be benign.
    • abortComputeMetaInfo

      public boolean abortComputeMetaInfo(String pvName)
    • getAllChannelsForPV

      public List<EngineContext.CommandThreadChannel> getAllChannelsForPV(String pvName)
    • getSampleBufferCapacityAdjustment

      public double getSampleBufferCapacityAdjustment()
      Per FRIB/PSI, we have a configuration knob to increase/decrease the sample buffer size used by the engine for all PV's. This comes from archappl.properties and is a double - by default 1.0 which means we leave the buffer size computation as is. If you want to increase buffer size globally to 150% of what is normally computed, set this to 1.5
      Returns:
      sampleBufferCapacityAdjustment  
    • getCAJChannelCount

      public int getCAJChannelCount()
      Get the total channel count as CAJ sees it.
      Returns:
      totalCAJChannelCount  
    • getPVAClient

      public org.epics.pva.client.PVAClient getPVAClient()
    • getMiscTasksScheduler

      public ScheduledThreadPoolExecutor getMiscTasksScheduler()
    • getMainSchedulerPendingTasks

      public int getMainSchedulerPendingTasks()
      Get the number of tasks pending in the main scheduler. This is the one that powers the write thread.
      Returns:
    • getCAJContextDetails

      public List<Map<String,String>> getCAJContextDetails()
      Return some details on the CAJ contexts for the metrics page.
      Returns:
    • getPausedPVCount

      public int getPausedPVCount()
    • getCommandThreadDetails

      public List<Map<String,String>> getCommandThreadDetails()