Class LimitedMemoryExchangeStore
java.lang.Object
com.predic8.membrane.core.exchangestore.AbstractExchangeStore
com.predic8.membrane.core.exchangestore.LimitedMemoryExchangeStore
- All Implemented Interfaces:
ExchangeStore
- Description
- Stores exchange objects in-memory until a memory threshold is reached. When the threshold is reached and new exchanges arrive then old exchanges will be dropped (starting from oldest ascending) until the exchange can be stored. The LimitedMemoryExchangeStore is the default ExchangeStore Membrane uses.
-
Field Summary
Fields inherited from class com.predic8.membrane.core.exchangestore.AbstractExchangeStore
exchangesStoreListeners -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionObject[]List<? extends ClientStatistics>intgetExchangeById(long id) getExchanges(RuleKey ruleKey) longintintintgetNumberOfExchanges(RuleKey ruleKey) getStatistics(RuleKey key) voidremove(AbstractExchange exc) voidremoveAllExchanges(AbstractExchange[] candidates) voidremoveAllExchanges(Rule rule) voidsetBodyExceedingMaxSizeStrategy(BodyCollectingMessageObserver.Strategy bodyExceedingMaxSizeStrategy) voidsetMaxBodySize(int maxBodySize) voidsetMaxSize(int maxSize) voidsnap(AbstractExchange exc, Interceptor.Flow flow) Adds the current state of the exchange to the store.voidwaitForModification(long lastKnownModification) Returns immediately if lastKnownModification is smaller than last known modification.Methods inherited from class com.predic8.membrane.core.exchangestore.AbstractExchangeStore
addExchangesStoreListener, collect, getFilteredSortedPaged, getMax, init, notifyListenersOnExchangeAdd, notifyListenersOnExchangeRemoval, pathContains, refreshExchangeStoreListeners, removeExchangesStoreListener, requestHeaderContains, responseHeaderContains
-
Constructor Details
-
LimitedMemoryExchangeStore
public LimitedMemoryExchangeStore()
-
-
Method Details
-
snap
Description copied from interface:ExchangeStoreAdds the current state of the exchange to the store.Implementations should take a snapshot of the current state of the request (or response) headers and register a body observer in which they will be called back as soon as the body has fully been received.
If flow==REQUEST, the request is added. Elsewise, the response is added (if present).
-
remove
-
removeAllExchanges
-
getExchanges
-
getNumberOfExchanges
-
getStatistics
-
getAllExchanges
-
getAllExchangesAsList
-
removeAllExchanges
-
getExchangeById
- Specified by:
getExchangeByIdin interfaceExchangeStore- Overrides:
getExchangeByIdin classAbstractExchangeStore
-
search
-
getClientStatistics
- Specified by:
getClientStatisticsin interfaceExchangeStore- Overrides:
getClientStatisticsin classAbstractExchangeStore
-
getCurrentSize
public int getCurrentSize() -
getOldestTimeResSent
-
getMaxSize
public int getMaxSize() -
setMaxSize
public void setMaxSize(int maxSize) - Default
- 1000000
- Description
- Threshold limit in bytes until old exchanges are dropped.
- Example
- 1048576(1Mb)
-
getLastModified
public long getLastModified()- Specified by:
getLastModifiedin interfaceExchangeStore- Overrides:
getLastModifiedin classAbstractExchangeStore
-
waitForModification
Description copied from interface:ExchangeStoreReturns immediately if lastKnownModification is smaller than last known modification. Otherwise it waits until a modification occurs.- Specified by:
waitForModificationin interfaceExchangeStore- Overrides:
waitForModificationin classAbstractExchangeStore- Throws:
InterruptedException
-
getMaxBodySize
public int getMaxBodySize() -
setMaxBodySize
public void setMaxBodySize(int maxBodySize) - Default
- 100000
- Description
Maximum body size limit in bytes. If bodies are collected, which exceed this limit, the strategy determines, what happens.
-
getBodyExceedingMaxSizeStrategy
-
setBodyExceedingMaxSizeStrategy
public void setBodyExceedingMaxSizeStrategy(BodyCollectingMessageObserver.Strategy bodyExceedingMaxSizeStrategy) - Default
- TRUNCATE
- Description
- The strategy to use (TRUNCATE or ERROR) when a HTTP message body is larger than the maxBodySize. TRUNCATE means that only the first bytes are kept in memory. ERROR means that HTTP requests exceeding this limit will cause an error and not be processed any further: If the request exceeds the limit, it will not be processed further; if the response exceeds the limit, it will not be processed further. ("Further processing" usually includes transmission over a network.)
-