public class PVManager extends Object
PVReader
, PVWriter
and PV
from an read or write expression.
NotificationExecutor - This is used for all notifications.
By default this uses Executors.localThread()
so that
the notification are done on whatever current thread needs to notify.
This means that new read notifications are run on threads managed by
the ReadScannerExecutorService, write notifications are run on threads
managed by the DataSource and exceptions notification are run on the thread
where the exception is done. This can be changed to make all notifications
routed to single threaded sub-systems, such as UI environments like SWING,
SWT or similar. This can be changed on a PV by PV basis.
AsynchWriteExecutor - This is used for asynchronous writes, to return
right away, and for running timeouts on each write.
By default this uses the internal PVManager work pool. The work
submitted here is the calculation of the corresponding WriteExpression
and submission to the DataSource
. The DataSource itself typically
has asynchronous work, which is executed in the DataSource specific threads.
Changing this to Executors.localThread()
will make that preparation
task on the thread that calls PVWriter.write(java.lang.Object)
but
it will not transform the call in a synchronous call.
ReadScannerExecutorService - This is used to run the periodic
scan for new values. By default this uses the internal PVManager work pool. The work
submitted here is the calculation of the corresponding DesiredRateExpression
and submission to the NotificationExecutor.
Constructor and Description |
---|
PVManager() |
Modifier and Type | Method and Description |
---|---|
static ScheduledExecutorService |
getAsyncWriteExecutor()
Returns the current executor on which the asynchronous calls are executed.
|
static DataSource |
getDefaultDataSource()
Returns the current default data source.
|
static Executor |
getDefaultNotificationExecutor()
Returns the current default executor that will execute all notifications.
|
static ScheduledExecutorService |
getReadScannerExecutorService()
Returns the executor service used to schedule and run the
periodic reading scan for new values.
|
static <T> PVReaderConfiguration<T> |
read(DesiredRateExpression<T> pvExpression)
Reads the given expression, and returns an object to configure the parameters
for the read.
|
static <T> PVReaderConfiguration<T> |
read(SourceRateExpression<T> pvExpression)
Reads the given expression, and returns an object to configure the parameters
for the read.
|
static <R,W> PVConfiguration<R,W> |
readAndWrite(DesiredRateReadWriteExpression<R,W> readWriteExpression)
Both reads and writes the given expression, and returns an object to configure the parameters
for the both read and write.
|
static <R,W> PVConfiguration<R,W> |
readAndWrite(SourceRateReadWriteExpression<R,W> readWriteExpression)
Both reads and writes the given expression, and returns an object to configure the parameters
for the both read and write.
|
static void |
setAsyncWriteExecutor(ScheduledExecutorService asyncWriteExecutor)
Changes the executor used for the asynchronous write calls.
|
static void |
setDefaultDataSource(DataSource dataSource)
Changes the default source for data.
|
static void |
setDefaultNotificationExecutor(Executor notificationExecutor)
Changes the default executor on which all notifications are going to be posted.
|
static void |
setReadScannerExecutorService(ScheduledExecutorService readScannerExecutorService)
Changes the executor service to use for executing the periodic read
scan.
|
static <T> PVWriterConfiguration<T> |
write(WriteExpression<T> writeExpression)
Writes the given expression, and returns an object to configure the parameters
for the write.
|
public static void setDefaultNotificationExecutor(Executor notificationExecutor)
notificationExecutor
- the new notification executorpublic static Executor getDefaultNotificationExecutor()
public static void setDefaultDataSource(DataSource dataSource)
dataSource
- the data sourcepublic static DataSource getDefaultDataSource()
public static <T> PVReaderConfiguration<T> read(SourceRateExpression<T> pvExpression)
T
- type of the read payloadpvExpression
- the expression to readpublic static <T> PVReaderConfiguration<T> read(DesiredRateExpression<T> pvExpression)
T
- type of the read payloadpvExpression
- the expression to readpublic static <T> PVWriterConfiguration<T> write(WriteExpression<T> writeExpression)
T
- type of the write payloadwriteExpression
- the expression to writepublic static <R,W> PVConfiguration<R,W> readAndWrite(SourceRateReadWriteExpression<R,W> readWriteExpression)
read(org.epics.pvmanager.expression.SourceRateExpression)
and write(org.epics.pvmanager.expression.WriteExpression)
at the same time.R
- type of the read payloadW
- type of the write payloadreadWriteExpression
- the expression to read and writepublic static <R,W> PVConfiguration<R,W> readAndWrite(DesiredRateReadWriteExpression<R,W> readWriteExpression)
read(org.epics.pvmanager.expression.SourceRateExpression)
and write(org.epics.pvmanager.expression.WriteExpression)
at the same time.R
- type of the read payloadW
- type of the write payloadreadWriteExpression
- the expression to read and writepublic static ScheduledExecutorService getAsyncWriteExecutor()
public static void setAsyncWriteExecutor(ScheduledExecutorService asyncWriteExecutor)
asyncWriteExecutor
- the new executorpublic static ScheduledExecutorService getReadScannerExecutorService()
public static void setReadScannerExecutorService(ScheduledExecutorService readScannerExecutorService)
readScannerExecutorService
- the new service for the read operationsCopyright © 2010–2015. All rights reserved.