Class SemaphoreProcessor
java.lang.Object
org.scictrl.csshell.epics.server.processor.AbstractValueProcessor
org.scictrl.csshell.epics.server.processor.MemoryValueProcessor
org.scictrl.csshell.epics.server.processor.SemaphoreProcessor
- All Implemented Interfaces:
ValueProcessor
Semaphore is a processor which acts as remote process semaphore: it allows only one
remote process ID to be registered as active.
Remote process sets own ID as string to the semaphore. If semaphore is free,
this means string value is empty, it will accept the ID for a minute.
Process will host semaphore as long as it will reset it's
ID before expires. Setting semaphore to empty string will release semaphore.
Process, which ID is set on semaphore, is being allowed to access some resource.
Before a process can access such a resource, it must check the semaphore and proceed
only if semaphore accepted it's ID.
- Author:
- igor@scictrl.com
-
Field Summary
Fields inherited from class org.scictrl.csshell.epics.server.processor.MemoryValueProcessor
fixed, lastChangeTimestamp, timestamp, valueFields inherited from class org.scictrl.csshell.epics.server.processor.AbstractValueProcessor
log, record, trigger, type -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean_setValue(Object value, gov.aps.jca.dbr.Severity severity, gov.aps.jca.dbr.Status status, boolean notify, boolean force) Internal set: sets new value to this processor.voidConfigures the internals of value processor, provides reference to parent record and to configuration with root inside processor tag.voidprocess()Called by Database in interval set by the trigger parameter in milliseconds.Methods inherited from class org.scictrl.csshell.epics.server.processor.MemoryValueProcessor
_forceValueUpdateEvent, _setValue, _setValue, _setValue, activate, convert, getChangeAccessTimestamp, getTimestamp, getValue, getValueAsBoolean, isFixed, newBooleanProcessor, newDoubleProcessor, newProcessor, newProcessor, setFixed, setValueMethods inherited from class org.scictrl.csshell.epics.server.processor.AbstractValueProcessor
getName, getRecord, getTrigger, getType, toString
-
Constructor Details
-
SemaphoreProcessor
public SemaphoreProcessor()Constructor for SemaphoreProcessor.
-
-
Method Details
-
configure
public void configure(Record record, org.apache.commons.configuration.HierarchicalConfiguration config) Configures the internals of value processor, provides reference to parent record and to configuration with root inside processor tag. Parent record is not yet initialized, so does not have reference to Database, the Database reference will be available during activate call.- Specified by:
configurein interfaceValueProcessor- Overrides:
configurein classMemoryValueProcessor- Parameters:
record- the parent record.config- configuration with room inside processor tag.
-
_setValue
protected boolean _setValue(Object value, gov.aps.jca.dbr.Severity severity, gov.aps.jca.dbr.Status status, boolean notify, boolean force) Internal set: sets new value to this processor. It checks if it is fixed, it never sets fixed value. Fires value update event only if value was changes and notify is true. If force is true, then updates value and fires notify, if notify is true, even if value was not changed. If the value is not an array it tries to convert it to a single element array. Updates timestamp. If required fires notify event.- Overrides:
_setValuein classMemoryValueProcessor- Parameters:
value- value to be setseverity- the severity to be used together with the value update. Ifnullno alarm update is fired.status- the status to be used together with the value update. Ifnullno alarm update is fired.notify- iftruefire notify event if value was change,falsesuppresses eventsforce- iftrueit will update value and timestamp even if there is not new value and proceeds with notify- Returns:
- true if value was updated, regardless if based on difference or force
-
process
public void process()Called by Database in interval set by the trigger parameter in milliseconds. Not called if trigger in 0.- Specified by:
processin interfaceValueProcessor- Overrides:
processin classAbstractValueProcessor
-