The framework internally uses the class Exchange to manage an exchange of {@link Request}s and {@link Response}s. The Exchange only contains state, no functionality. The CoAP Stack contains the functionality of the CoAP protocol and modifies the exchange appropriately. The class Exchange and its fields are NOT thread-safe.
The class {@link CoapExchange} provides the corresponding API for developers.Proceed with caution when using this class directly, e.g., through {@link CoapExchange#advanced()}.
This class might change with the implementation of CoAP extensions.
Financial products are often traded at a specific location known as an exchange. This interface represents details of the exchange.
This interface is read-only. Implementations may be mutable.
The main facade for fetching, storing and removing records from a Persistit™ database.
Applications interact with Persistit through instances of this class. A Exchange
has two important associated member objects, a {@link com.persistit.Key} and a {@link com.persistit.Value}. A Key
is a mutable representation of a key, and a Value
is a mutable representation of a value. Applications manipulate these objects and interact with the database through one of the following four general patterns:
Key
, perform a {@link com.persistit.Exchange#fetch fetch} operation, and query the Value
.Key
, modify the Value
, and then perform a {@link com.persistit.Exchange#store store} operation to insert or replacedata in the database.Key
, and then perform a {@link com.persistit.Exchange#remove remove} to remove one or more key/valuepairs.Key
, perform a {@link com.persistit.Exchange#traverse traverse} operation, then query theresulting state of Key
and/or Value
to enumerate key/value pairs currently stored in the database. Additional methods of Exchange
include {@link #fetchAndStore fetchAndStore} and {@link #fetchAndRemove fetchAndRemove} which atomicallymodify the database and return the former value associated with the current Key
.
Exchange
and its associated Key
and Value
instances are not thread-safe. Generally each Thread
should allocate and use its own Exchange
instances. Were it to occur, modification of the Key
or Value
objects associated with an Exchange
by another thread could cause severe and unpredictable errors, including possible corruption of the underlying data storage. While the methods of one Exchange
instance are not threadsafe, Persistit is designed to allow multiple threads, using multiple Exchange
instances, to access and update the underlying database in a highly concurrent fashion.
Exchange
instances. However, depending on the garbage collection performance characteristics of a particular JVM it may be desirable to maintain a pool of Exchange
s available for reuse, thereby reducing the frequency with which Exchange
s need to be constructed and then garbage collected. An application may get an Exchange using {@link Persistit#getExchange(String,String,boolean)} or{@link Persistit#getExchange(Volume,String,boolean)}. These methods reuse a previously constructed Exchange
if one is available in a pool; otherwise they construct methods construct a new one. Applications using the Exchange pool should call {@link Persistit#releaseExchange(Exchange,boolean)} to relinquish anExchange
once it is no longer needed, thereby placing it in the pool for subsequent reuse.
@version 1.0
Interface to provide the following to applications:
The consumer is given a choice of a default (no-args) or configured accessor
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|