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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
EngineContext.CommandThreadChannel
Go thru all the contexts and return channels whose names match this This is to be used for for testing purposes only.
-
Constructor Summary
Constructors Constructor Description EngineContext(ConfigService configService)
This EngineContext should always be singleton
-
Method Summary
Modifier and Type Method Description boolean
abortComputeMetaInfo(String pvName)
int
assignJCACommandThread(String pvName, String iocHostName)
Use this to assign JCA command threads to PV'svoid
computeMetaInfo(PubSubEvent pubSubEvent)
boolean
doesContextMatchThread(gov.aps.jca.Context context, int jcaCommandThreadId)
List<EngineContext.CommandThreadChannel>
getAllChannelsForPV(String pvName)
double
getAverageSecondsConsumedByWriter()
int
getCAJChannelCount()
Get the total channel count as CAJ sees it.List<Map<String,String>>
getCAJContextDetails()
Return some details on the CAJ contexts for the metrics page.ConcurrentHashMap<String,ArchiveChannel>
getChannelList()
org.epics.pvaccess.client.ChannelProvider
getChannelProvider()
ConcurrentHashMap<String,ControllingPV>
getControlingPVList()
JCACommandThread
getJCACommandThread(int jcaCommandThreadId)
int
getMainSchedulerPendingTasks()
Get the number of tasks pending in the main scheduler.ScheduledThreadPoolExecutor
getMiscTasksScheduler()
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.ScheduledThreadPoolExecutor
getScanScheduler()
Get the scheduler used for SCAN PV'sScheduledThreadPoolExecutor
getScheduler()
double
getWritePeriod()
WriterRunnable
getWriteThead()
boolean
isWriteThreadStarted()
void
setDisconnectCheckTimeoutInMinutesForTestingPurposesOnly(int newDisconnectCheckTimeoutMins)
void
setSecondsConsumedByWriter(double secondsConsumedByWriter)
set the time consumed by writer to write the sample buffer oncevoid
startWriteThread(ConfigService configservice)
start the write thread of the engine and this is actually called by the first pv when creating channel
-
-
-
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
-
getControlingPVList
public ConcurrentHashMap<String,ControllingPV> getControlingPVList()
- Returns:
- the list of pvs controlling other pvs
-
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 PViocHostName
- Note this can and will often be null.- Returns:
- threadId
-
doesContextMatchThread
public boolean doesContextMatchThread(gov.aps.jca.Context context, 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)
-
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.
-
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
-
getChannelProvider
public org.epics.pvaccess.client.ChannelProvider getChannelProvider()
-
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:
-
-