Class Memory
java.lang.Object
com.swiftmq.impl.streams.comp.memory.Memory
- Direct Known Subclasses:
HeapMemory
,QueueMemory
Abstract base class for Memories.
- Author:
- IIT Software GmbH, Muenster/Germany, (c) 2016, All Rights Reserved
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract Memory
Add a Message to the Memory.Internal use.protected void
addToIndexes
(String key, Message message) boolean
ascendingSeries
(String propName) Returns true if all values of a Property are greater than the previous value.abstract Message
at
(int index) Returns the Message at the index.double
Returns the average of all values of a Property.Checks the limit of the Memory and retires Messages, if necessary.abstract Memory
clear()
Removes all Messages from this Memory.protected void
void
close()
Closes this Memory.void
collect
(long interval) Internal use.createIndex
(String propName) Creates an Index over a Propertyvoid
Internal use.boolean
descendingSeries
(String propName) Returns true if all values of a Property are less than the previous value.dropLateArrivals
(boolean dropLateArrivals) Specifies whether late arrivals should be dropped (default is false).first()
Returns the first Message of this Memory.void
forEach
(ForEachMessageCallback callback) Executes the Callback for each Message in this Memoryabstract long
getStoreTime
(int index) Internal use.protected long
getStoreTime
(Message message) Internal use.Groups all Messages over a Property and returns a Group Result.Sets and returns the InactivityTimeout for this Memory.Returns the Index of the specific Property nameprotected boolean
boolean
Internal use.Performs an inner join with the right Memory over the named join Property name which must exists in the Messages of both Memories.Performs an inner join with the right Memory.last()
Returns the last Message of this Memory.limit()
Returns a new LimitBuilderReturns the Message with the maximum value of a Property.Returns the Message with the minimum value of a Property.name()
Returns the name of this Memoryprotected String
newKey()
onRetire
(RetirementCallback callback) Sets a callback which is called for each Message that is retired (removed by a Limit).orderBy()
Returns the orderBy Property name.Sets the Property name that is used to order this Memory.abstract void
reload()
Internal use.abstract Memory
remove
(int index) Removes the Message at the index.abstract Memory
Removes all Messages from this Memory that matches the JMS message selector and returns this Memory.protected void
removeFromIndexes
(String key, Message message) abstract Memory
removeOlderThan
(long time) Removes all Messages with a store time older than time.abstract Memory
removeOlderThan
(long time, boolean executeCallback) Internal use.Returns the RetirementCallback.reverse()
Reverses the Message order of this Memory and returns a new Memory with the result.abstract Memory
Applies a JMS message selector to all Messages in this Memory and returns a new non-queue Memory with the result.abstract int
size()
Returns the number of Messages stored in this Memory.Sorts all Messages of this Memory over a Property and returns a new Memory with the result.double
Returns the sum of all values of a Property.Returns all values of a Property in the Message order.
-
Method Details
-
name
Returns the name of this Memory- Returns:
- Name
-
limit
Returns a new LimitBuilder- Returns:
- LimitBuilder
-
addLimit
Internal use. -
orderBy
Sets the Property name that is used to order this Memory. This is useful to order a Memory by event time instead of processing time. Default is processing time which is the time at which the Message is added to the Memory.- Parameters:
orderByProperty
- Name of the Property- Returns:
- this
-
orderBy
Returns the orderBy Property name.- Returns:
- Property name
-
inactivityTimeout
Sets and returns the InactivityTimeout for this Memory. An InactivityTimeout can be attached to a Memory and specifies a time of inactivity (no adds to Memory) after which all Messages in that Memory will retire. Inactivity is checked during Memory.checkLimit() and thus needs to be regularly called from a Timer.- Returns:
-
dropLateArrivals
Specifies whether late arrivals should be dropped (default is false). Late arrivals are only respected if orderBy(propName) is set (thus, event time processing). A late arrival is defined as an event time that is less the time of the maximum event time of the previous window close (onRetire).- Parameters:
dropLateArrivals
- true/false- Returns:
- this
-
isLate
-
getStoreTime
-
getStoreTimes
Internal use.- Throws:
Exception
-
getStoreTime
public abstract long getStoreTime(int index) Internal use. -
createIndex
Creates an Index over a Property- Parameters:
propName
- Property Name- Returns:
- Memory
-
index
Returns the Index of the specific Property name- Parameters:
propName
- Property Name- Returns:
- Index
-
newKey
-
addToIndexes
-
removeFromIndexes
-
clearIndexes
protected void clearIndexes() -
reload
Internal use.- Throws:
Exception
-
add
Add a Message to the Memory.- Parameters:
message
- Message- Returns:
- Memory
- Throws:
Exception
-
remove
Removes the Message at the index.- Parameters:
index
- index- Returns:
- Memory
- Throws:
Exception
-
removeOlderThan
Removes all Messages with a store time older than time.- Parameters:
time
- Time- Returns:
- Memory
- Throws:
Exception
-
removeOlderThan
Internal use.- Throws:
Exception
-
at
Returns the Message at the index.- Parameters:
index
- index- Returns:
- Message
- Throws:
Exception
-
size
Returns the number of Messages stored in this Memory.- Returns:
- Number Messages
- Throws:
Exception
-
clear
Removes all Messages from this Memory.- Returns:
- Memory
- Throws:
Exception
-
select
Applies a JMS message selector to all Messages in this Memory and returns a new non-queue Memory with the result.- Parameters:
selector
- JMS Message Selector- Returns:
- Result
- Throws:
Exception
-
remove
Removes all Messages from this Memory that matches the JMS message selector and returns this Memory.- Parameters:
selector
- JMS Message Selector- Returns:
- Memory (this)
- Throws:
Exception
-
checkLimit
Checks the limit of the Memory and retires Messages, if necessary. These retired Messages will be passed to the RetirementListener, if set. The method checks also if there is an inactivity timeout and retires all Messages when a timeout occurs.- Returns:
- Memory (this)
-
first
Returns the first Message of this Memory.- Returns:
- Message
- Throws:
Exception
-
last
Returns the last Message of this Memory.- Returns:
- Message
- Throws:
Exception
-
reverse
Reverses the Message order of this Memory and returns a new Memory with the result.- Returns:
- Result
- Throws:
Exception
-
values
Returns all values of a Property in the Message order.- Parameters:
propName
- Property Name- Returns:
- List of values
- Throws:
Exception
-
group
Groups all Messages over a Property and returns a Group Result.- Parameters:
propName
- Property Name- Returns:
- GroupResult
- Throws:
Exception
-
sort
Sorts all Messages of this Memory over a Property and returns a new Memory with the result.- Parameters:
propName
- Property Name- Returns:
- Result
- Throws:
Exception
-
min
Returns the Message with the minimum value of a Property.- Parameters:
propName
- Property Name- Returns:
- Message
- Throws:
Exception
-
max
Returns the Message with the maximum value of a Property.- Parameters:
propName
- Property Name- Returns:
- Message
- Throws:
Exception
-
sum
Returns the sum of all values of a Property.- Parameters:
propName
- Property Name- Returns:
- sum
- Throws:
Exception
-
average
Returns the average of all values of a Property.- Parameters:
propName
- Property Name- Returns:
- average
- Throws:
Exception
-
ascendingSeries
Returns true if all values of a Property are greater than the previous value.- Parameters:
propName
- Property Name- Returns:
- true/false
- Throws:
Exception
-
descendingSeries
Returns true if all values of a Property are less than the previous value.- Parameters:
propName
- Property Name- Returns:
- true/false
- Throws:
Exception
-
join
Performs an inner join with the right Memory over the named join Property name which must exists in the Messages of both Memories. Result is a Memory which contains Messages where each Message at the left side (this Memory) matches with a Message on the right side. The result Message will contain the left result Message enriched with all Properties of the right result Message.- Parameters:
right
- Memory to join withjoinProp
- Name of the Property to join over- Returns:
- result Memory
- Throws:
Exception
-
join
Performs an inner join with the right Memory. Use this method to join 2 Memories over different Property names.- Parameters:
right
- Memory to join withleftJoinProp
- left join Property namerightJoinProp
- right join Property name- Returns:
- result Memory
- Throws:
Exception
-
forEach
Executes the Callback for each Message in this Memory- Parameters:
callback
- Callback- Throws:
Exception
-
onRetire
Sets a callback which is called for each Message that is retired (removed by a Limit).- Parameters:
callback
- Callback- Returns:
-
retirementCallback
Returns the RetirementCallback.- Returns:
- RetirementCallback
-
collect
public void collect(long interval) Internal use. -
deferredClose
public void deferredClose()Internal use. -
isMarkedAsClose
public boolean isMarkedAsClose()Internal use. -
close
public void close()Closes this Memory.
-