public class S_LibraryServiceRdbmsEventExchanger extends Object
Modifier and Type | Class and Description |
---|---|
protected class |
S_LibraryServiceRdbmsEventExchanger.EventDate
An inner class holds an event id and a date.
|
protected class |
S_LibraryServiceRdbmsEventExchanger.MissingEvent
A structure that represents a missing event.
|
Modifier and Type | Field and Description |
---|---|
protected Connection |
m_Connection
The SQL Connection used for events.
|
protected PreparedStatement |
m_DequeueStatement
The dequeue statement.
|
protected PreparedStatement |
m_EnqueueStatement
The enqueue statement.
|
protected Vector |
m_EventDates
A Vector of EventDate objects, used for purging old events.
|
protected Thread |
m_EventExchangerThread
Synchronizes threads.
|
protected Vector |
m_EventsQueuedForTransport
Events queued for transport to other services.
|
protected int |
m_EventTransportBatchSize
The number of events that should be transported in a single batch.
|
protected long |
m_LastProcessEventsFromOtherServicesTime
The time at which processEventsFromOtherServices was last invoked.
|
protected long |
m_LastReleaseEventsQueuedForTransportTime
The time at which releaseEventsQueuedForTransport was last invoked.
|
protected LibraryConnection |
m_LibraryConnection
The LibraryConnection used for events.
|
protected long |
m_MaxReceivedEventId
The highest event id of all previously dequeued events.
|
protected Hashtable |
m_MissingEvents
The "missing events", as a Hashtable of MissingEvents hashed
by event id.
|
protected long |
m_ProcessEventsFromOtherServicesPeriod
The target time between successive processEventsFromOtherServices
invocations, in milliseconds.
|
protected int |
m_ReleasedEventCount
The number of events that have been released since the last
time the prepared insert statement was opened.
|
protected long |
m_ReleaseEventsQueuedForTransportPeriod
The target time between successive releaseEventsQueuedForTransport
invocations, in milliseconds.
|
protected S_LibraryService |
m_Service
The owner service.
|
protected long |
m_ServiceId
The id of the owner service.
|
protected boolean |
m_Started
Whether this S_LibraryServiceEventExchanger is started.
|
protected int |
m_StatementResetLimit
The number of events that can be released before the prepared insert
statement is closed and re-opened.
|
Modifier | Constructor and Description |
---|---|
protected |
S_LibraryServiceRdbmsEventExchanger()
Constructs a S_LibraryServiceRdbmsEventExchanger.
|
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Shuts down this S_LibraryServiceRdbmsEventExchanger.
|
void |
flush()
Flushes any buffered outgoing or incoming events.
|
void |
forceRead()
Forces a read of any incoming events.
|
void |
init(S_LibraryService service,
long postPeriod,
long pollPeriod,
int statementResetLimit,
int eventTransportBatchSize)
Initializes this S_LibraryServiceRdbmsEventExchanger.
|
void |
postEvent(IfsEvent event)
Posts the specified event to all other services.
|
Integer |
purgeEvents(Long thresholdAge)
Purges events older than a threshold age.
|
void |
start()
Starts this S_LibraryServiceEventExchanger.
|
void |
stop()
Stops this S_LibraryServiceEventExchanger.
|
void |
tick()
Provides a hook to perform psuedo-background processing.
|
protected S_LibraryService m_Service
protected long m_ServiceId
protected boolean m_Started
protected long m_ReleaseEventsQueuedForTransportPeriod
protected long m_LastReleaseEventsQueuedForTransportTime
protected long m_ProcessEventsFromOtherServicesPeriod
protected long m_LastProcessEventsFromOtherServicesTime
protected int m_StatementResetLimit
A value of zero indicates that the statement should never be reset.
protected int m_ReleasedEventCount
Not maintained if the value of m_StatementResetLimit is zero.
protected int m_EventTransportBatchSize
A value of zero indicates that a defualt value should be used.
protected LibraryConnection m_LibraryConnection
protected Connection m_Connection
protected PreparedStatement m_EnqueueStatement
protected PreparedStatement m_DequeueStatement
protected long m_MaxReceivedEventId
protected Hashtable m_MissingEvents
A missing event is detected by a gap in the dequeued event ids.
protected Vector m_EventsQueuedForTransport
protected Vector m_EventDates
protected Thread m_EventExchangerThread
protected S_LibraryServiceRdbmsEventExchanger()
public final void init(S_LibraryService service, long postPeriod, long pollPeriod, int statementResetLimit, int eventTransportBatchSize) throws IfsException
service
- the S_LibraryServicepostPeriod
- the maximum period, in milliseconds, that the
S_LibraryServiceRdbmsEventExchanger should
buffer outgoing events; a value of 0 indicates
that events should be transported immediately,
and not buffered at allpollPeriod
- the maximum period, in milliseconds, within
which any incoming event should be processed;
a value of 0 indicates that inter-service
event transport is disabledstatementResetLimit
- The number of events that can be released
before the prepared insert statement is closed
and re-opened. A value of zero indicates that
the statement should never be reset.eventTransportBatchSize
- The batch size to be used for transport.
A value of zero indicates that
the default should be used.IfsException
- (IFS-11010) if the operation failspublic final void start() throws IfsException
Until an S_LibraryServiceEventExchanger is started, any calls to
postEvent
and any events from other services are ignored.
IfsException
- (IFS-11013) if the operation failspublic final void stop() throws IfsException
While an S_LibraryServiceEventExchanger is stopped, any calls to
postEvent
and any events from other services are ignored.
IfsException
- (IFS-11014) if the operation failspublic final void dispose()
IfsException
- if the operation failspublic void postEvent(IfsEvent event) throws IfsException
event
- the eventIfsException
- (IFS-11011) if the operation failspublic final void tick() throws IfsException
See the class description.
IfsException
- if the operation failspublic void flush() throws IfsException
IfsException
- if the operation failspublic void forceRead() throws IfsException
IfsException
- if the operation failspublic final Integer purgeEvents(Long thresholdAge) throws IfsException
See the class description.
thresholdAge
- the maximum desired event age, in seconds,
or null if unspecifiedIfsException
- (IFS-11015) if the operation failsCopyright © 2023. All rights reserved.