Class EngineContext


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

      • EngineContext

        public EngineContext​(ConfigService configService)
        This EngineContext should always be singleton
        Parameters:
        configService - the config service to initialize the engine context
    • Method Detail

      • setSecondsConsumedByWriter

        public void setSecondsConsumedByWriter​(double secondsConsumedByWriter)
        set the time consumed by writer to write the sample buffer once
        Parameters:
        secondsConsumedByWriter - the time in second consumed by writer to write the sample buffer once
      • getAverageSecondsConsumedByWriter

        public double getAverageSecondsConsumedByWriter()
        Returns:
        the average time in second consumed by writer
      • 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  
      • doesContextMatchThread

        public boolean doesContextMatchThread​(gov.aps.jca.Context context,
                                              int jcaCommandThreadId)
      • 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)
      • abortComputeMetaInfo

        public boolean abortComputeMetaInfo​(String pvName)
      • setDisconnectCheckTimeoutInMinutesForTestingPurposesOnly

        public void setDisconnectCheckTimeoutInMinutesForTestingPurposesOnly​(int newDisconnectCheckTimeoutMins)
        Parameters:
        newDisconnectCheckTimeoutMins - This is to be used only for unit testing purposes... There are no guarantees that using this on a running server will be benign.
      • 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  
      • getChannelProvider

        public org.epics.pvaccess.client.ChannelProvider getChannelProvider()
      • 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: