class EtJniAccess
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
(package private) static java.util.concurrent.locks.ReentrantLock |
classLock
Serialize access to classMap and creation of these objects.
|
(package private) static java.util.HashMap<java.lang.String,EtJniAccess> |
classMap
Store EtJniAccess objects here since we only want to create 1 object per ET system.
|
(package private) static boolean |
jniLibLoaded
Has the jni library been loaded?
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
close()
Close the local, C-based ET system that we previously opened.
|
(package private) void |
dumpEvents(long etId,
int attId,
EtEventImpl[] evs,
int length)
Dump (dispose of) the given array of unwanted events back into the local, C-based ET system.
|
(package private) EtEventImpl[] |
getEvents(long etId,
int attId,
int mode,
int sec,
int nsec,
int count)
Get events from the local, C-based ET system.
|
(package private) static EtJniAccess |
getInstance(java.lang.String etName)
Get an instance of this object for a particular ET system.
|
(package private) long |
getLocalEtId()
Get the et id.
|
(package private) void |
killEtSystem(long etId)
Kill the local, C-based ET system that we previously opened.
|
(package private) EtEventImpl[] |
newEvents(long etId,
int attId,
int mode,
int sec,
int nsec,
int count,
int size,
int group)
Get new (unused) events from a specified group of such events from the local, C-based ET system.
|
(package private) void |
putEvents(long etId,
int attId,
EtEventImpl[] evs,
int length)
Put the given array of events back into the local, C-based ET system.
|
static java.util.concurrent.locks.ReentrantLock classLock
static java.util.HashMap<java.lang.String,EtJniAccess> classMap
static boolean jniLibLoaded
static EtJniAccess getInstance(java.lang.String etName) throws org.jlab.coda.et.exception.EtException, org.jlab.coda.et.exception.EtTimeoutException
etName
- name of ET system to openorg.jlab.coda.et.exception.EtException
- for failure to load the jni library;
for any failure to open ET system except timeoutorg.jlab.coda.et.exception.EtTimeoutException
- for failure to open ET system within the specified time limitlong getLocalEtId()
void close()
void killEtSystem(long etId)
etId
- ET system idvoid putEvents(long etId, int attId, EtEventImpl[] evs, int length) throws org.jlab.coda.et.exception.EtException, org.jlab.coda.et.exception.EtDeadException, org.jlab.coda.et.exception.EtClosedException
etId
- ET system idattId
- attachment idevs
- array of eventslength
- number of events to be put (starting at index of 0)org.jlab.coda.et.exception.EtException
- for variety of general errorsorg.jlab.coda.et.exception.EtDeadException
- if ET system is deadorg.jlab.coda.et.exception.EtClosedException
- if ET system is closedvoid dumpEvents(long etId, int attId, EtEventImpl[] evs, int length) throws org.jlab.coda.et.exception.EtException, org.jlab.coda.et.exception.EtDeadException, org.jlab.coda.et.exception.EtClosedException
etId
- ET system idattId
- attachment idevs
- array of event objectslength
- number of events to be dumped (starting at index of 0)org.jlab.coda.et.exception.EtException
- for variety of general errorsorg.jlab.coda.et.exception.EtDeadException
- if ET system is deadorg.jlab.coda.et.exception.EtClosedException
- if ET system is closedEtEventImpl[] getEvents(long etId, int attId, int mode, int sec, int nsec, int count) throws org.jlab.coda.et.exception.EtException, org.jlab.coda.et.exception.EtDeadException, org.jlab.coda.et.exception.EtClosedException, org.jlab.coda.et.exception.EtEmptyException, org.jlab.coda.et.exception.EtBusyException, org.jlab.coda.et.exception.EtTimeoutException, org.jlab.coda.et.exception.EtWakeUpException
etId
- ET system idattId
- attachment idmode
- if there are no events available, this parameter specifies
whether to wait for some by sleeping EtConstants.sleep
,
to wait for a set time EtConstants.timed
,
or to return immediately EtConstants.async
.sec
- the number of seconds to wait if a timed wait is specifiednsec
- the number of nanoseconds to wait if a timed wait is specifiedcount
- number of events desired. Size may be different from that requested.org.jlab.coda.et.exception.EtException
- if general errorsorg.jlab.coda.et.exception.EtDeadException
- if the ET system process is deadorg.jlab.coda.et.exception.EtClosedException
- if ET system is closedorg.jlab.coda.et.exception.EtEmptyException
- if the mode is asynchronous and the station's input list is emptyorg.jlab.coda.et.exception.EtBusyException
- if the mode is asynchronous and the station's input list is being used
(the mutex is locked)org.jlab.coda.et.exception.EtTimeoutException
- if the mode is timed wait and the time has expiredorg.jlab.coda.et.exception.EtWakeUpException
- if the attachment has been commanded to wakeupEtEventImpl[] newEvents(long etId, int attId, int mode, int sec, int nsec, int count, int size, int group) throws org.jlab.coda.et.exception.EtException, org.jlab.coda.et.exception.EtDeadException, org.jlab.coda.et.exception.EtClosedException, org.jlab.coda.et.exception.EtEmptyException, org.jlab.coda.et.exception.EtBusyException, org.jlab.coda.et.exception.EtTimeoutException, org.jlab.coda.et.exception.EtWakeUpException
etId
- ET system idattId
- attachment idmode
- if there are no new events available, this parameter specifies
whether to wait for some by sleeping EtConstants.sleep
,
to wait for a set time EtConstants.timed
,
or to return immediately EtConstants.async
.sec
- the number of seconds to wait if a timed wait is specifiednsec
- the number of nanoseconds to wait if a timed wait is specifiedcount
- number of events desiredsize
- the size in bytes of the events desiredgroup
- group number from which to draw new events. Some ET systems have
unused events divided into groups whose numbering starts at 1.
For ET system not so divided, all events belong to group 1.org.jlab.coda.et.exception.EtException
- if general errorsorg.jlab.coda.et.exception.EtDeadException
- if the ET system process is deadorg.jlab.coda.et.exception.EtClosedException
- if ET system is closedorg.jlab.coda.et.exception.EtEmptyException
- if the mode is asynchronous and the station's input list is emptyorg.jlab.coda.et.exception.EtBusyException
- if the mode is asynchronous and the station's input list is being used
(the mutex is locked)org.jlab.coda.et.exception.EtTimeoutException
- if the mode is timed wait and the time has expiredorg.jlab.coda.et.exception.EtWakeUpException
- if the attachment has been commanded to wakeup