Package edu.sc.seis.sod.source.event
Class AbstractEventSource
java.lang.Object
edu.sc.seis.sod.source.AbstractSource
edu.sc.seis.sod.source.event.AbstractEventSource
- All Implemented Interfaces:
EventSource
,Source
- Direct Known Subclasses:
BackwardsEventSource
,DelayedEventSource
,FdsnEvent
public abstract class AbstractEventSource extends AbstractSource implements EventSource
-
Field Summary
Fields Modifier and Type Field Description protected boolean
caughtUpToRealtime
static java.lang.String
EVENT_LAG
static java.lang.String
EVENT_QUERY_INCREMENT
static java.lang.String
EVENT_REFRESH_INTERVAL
protected boolean
everCaughtUpToRealtime
protected java.time.Duration
increment
protected java.time.Duration
lag
protected java.time.Instant
lastQueryTime
static java.time.Duration
MIN_INCREMENT
protected java.time.Duration
nearRealTimeInterval
protected java.time.Duration
refreshInterval
protected java.time.Instant
sleepUntilTime
Fields inherited from class edu.sc.seis.sod.source.AbstractSource
name, NAME_ELEMENT, RETRIES_ELEMENT
-
Constructor Summary
Constructors Constructor Description AbstractEventSource(java.lang.String name, int retries)
AbstractEventSource(org.w3c.dom.Element config, java.lang.String defaultName)
-
Method Summary
Modifier and Type Method Description protected boolean
caughtUpWithRealtime()
void
decreaseQueryTimeWidth()
decrease the time increment for queries, but only if it is larger than the minimum = 1Day to avoid many tiny queries to the server.java.time.Duration
getIncrement()
java.time.Duration
getLag()
protected java.time.Instant
getQueryEdge()
protected java.time.Instant
getQueryStart()
protected edu.sc.seis.sod.model.common.TimeRange
getQueryTime()
java.time.Duration
getRefreshInterval()
java.time.Instant
getSleepUntilTime()
java.time.Duration
getWaitBeforeNext()
If the source needs to wait for more events to arrive, it should return the amount of time it wants to wait with this method.void
increaseQueryTimeWidth()
protected boolean
isEverCaughtUpToRealtime()
protected java.time.Instant
resetQueryTimeForLag()
Scoots the query time back by the event lag amount from the run properties to the query start time at the earliestvoid
setIncrement(java.time.Duration increment)
void
setLag(java.time.Duration lag)
protected void
setQueryEdge(java.time.Instant edge)
sets the latest time queriedprotected void
updateQueryEdge(edu.sc.seis.sod.model.common.TimeRange queryTime)
Methods inherited from class edu.sc.seis.sod.source.AbstractSource
appendToName, getName, getRetries, getRetryStrategy, setRetryStrategy
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface edu.sc.seis.sod.source.event.EventSource
getEventTimeRange, hasNext, next
-
Field Details
-
caughtUpToRealtime
protected boolean caughtUpToRealtime -
everCaughtUpToRealtime
protected boolean everCaughtUpToRealtime -
lastQueryTime
protected java.time.Instant lastQueryTime -
sleepUntilTime
protected java.time.Instant sleepUntilTime -
increment
protected java.time.Duration increment -
lag
protected java.time.Duration lag -
refreshInterval
protected java.time.Duration refreshInterval -
nearRealTimeInterval
protected java.time.Duration nearRealTimeInterval -
EVENT_QUERY_INCREMENT
public static final java.lang.String EVENT_QUERY_INCREMENT- See Also:
- Constant Field Values
-
EVENT_REFRESH_INTERVAL
public static final java.lang.String EVENT_REFRESH_INTERVAL- See Also:
- Constant Field Values
-
EVENT_LAG
public static final java.lang.String EVENT_LAG- See Also:
- Constant Field Values
-
MIN_INCREMENT
public static final java.time.Duration MIN_INCREMENT
-
-
Constructor Details
-
AbstractEventSource
public AbstractEventSource(java.lang.String name, int retries) -
AbstractEventSource
public AbstractEventSource(org.w3c.dom.Element config, java.lang.String defaultName) throws ConfigurationException- Throws:
ConfigurationException
-
-
Method Details
-
getWaitBeforeNext
public java.time.Duration getWaitBeforeNext()Description copied from interface:EventSource
If the source needs to wait for more events to arrive, it should return the amount of time it wants to wait with this method.- Specified by:
getWaitBeforeNext
in interfaceEventSource
-
caughtUpWithRealtime
protected boolean caughtUpWithRealtime() -
isEverCaughtUpToRealtime
protected boolean isEverCaughtUpToRealtime() -
getQueryStart
protected java.time.Instant getQueryStart()- Returns:
- - the next time to start asking for events
-
getQueryTime
protected edu.sc.seis.sod.model.common.TimeRange getQueryTime()- Returns:
- - the next time range to be queried for events
-
increaseQueryTimeWidth
public void increaseQueryTimeWidth() -
decreaseQueryTimeWidth
public void decreaseQueryTimeWidth()decrease the time increment for queries, but only if it is larger than the minimum = 1Day to avoid many tiny queries to the server. -
resetQueryTimeForLag
protected java.time.Instant resetQueryTimeForLag()Scoots the query time back by the event lag amount from the run properties to the query start time at the earliest -
getQueryEdge
- Returns:
- - latest time queried
- Throws:
NotFound
-
setQueryEdge
protected void setQueryEdge(java.time.Instant edge)sets the latest time queried -
updateQueryEdge
protected void updateQueryEdge(edu.sc.seis.sod.model.common.TimeRange queryTime) -
getSleepUntilTime
public java.time.Instant getSleepUntilTime() -
getLag
public java.time.Duration getLag() -
getIncrement
public java.time.Duration getIncrement() -
setIncrement
public void setIncrement(java.time.Duration increment) -
setLag
public void setLag(java.time.Duration lag) -
getRefreshInterval
public java.time.Duration getRefreshInterval()
-