public interface TibMap
To create a map object, see
Realm.createMap.
To delete a map from a store, see
Realm.removeMap.
Prerequisite: Administrators must enable dynamic last-value durables in a persistence store. For more information, see TIBCO FTL Administration.
This file defines map calls.
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
PROPERTY_DOUBLE_PERSISTENCE_RETRY_DURATION
Retry duration for map operations; double.
|
static java.lang.String |
PROPERTY_STRING_LABEL
Property name for a map label; string.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Destroy a map object.
|
TibMapIterator |
createIterator(TibLock lock,
TibProperties props)
Create an iterator over the keys in a map
and associate it with a lock.
|
TibMapIterator |
createIterator(TibProperties props)
Create an iterator over the keys in a map.
|
Message |
get(java.lang.String key)
Get the value of a key in a map.
|
Message |
get(java.lang.String key,
TibLock lock)
Get the value of a key in a map as a locked operation.
|
Message[] |
getMultiple(java.lang.String[] keys)
Get the values for the specified keys from a map.
|
Message[] |
getMultiple(java.lang.String[] keys,
TibLock tiblock)
Get the values for the specified keys from a map
as a locked operation
|
long |
getSize()
Returns the size of the map.
|
long |
getSize(TibLock lock)
Returns the size of the map as a locked operation.
|
java.lang.String |
name()
Return the name of the map object.
|
void |
remove(java.lang.String key)
Remove a key/value pair from a map.
|
void |
remove(java.lang.String key,
TibLock lock)
Remove a key/value pair from a map as a locked operation.
|
void |
removeAll()
Remove all key/value pairs from a map.
|
void |
removeAll(TibLock lock)
Remove all key/value pairs from a map as a locked operation.
|
void |
removeMultiple(java.lang.String[] keys)
Remove multiple keys and their corresponding values from the map
|
void |
removeMultiple(java.lang.String[] keys,
TibLock tiblock)
Remove multiple keys and their corresponding values from the map
as a locked operation
|
void |
set(java.lang.String[] keys,
Message[] values)
Set Multiple key/value pairs in a map.
|
void |
set(java.lang.String[] keys,
Message[] values,
TibLock lock)
Set multiple key/value pairs in a map as a locked operation.
|
void |
set(java.lang.String key,
Message value)
Set a key/value pair in a map.
|
void |
set(java.lang.String key,
Message value,
TibLock lock)
Set a key/value pair in a map as a locked operation.
|
static final java.lang.String PROPERTY_DOUBLE_PERSISTENCE_RETRY_DURATION
When Realm.createMap(java.lang.String, java.lang.String, com.tibco.ftl.TibProperties), set(java.lang.String, com.tibco.ftl.Message), get(java.lang.String), getSize(), remove(java.lang.String),
or removeAll() (with lock or without
lock) cannot access the persistence server (usually because
of network failure or quorum unavailability), they can
automatically retry the interaction. The value of this
property overrides the retry behavior of the server.
Supply it to the map create call.
Values:
Closing the realm or destroying the map supersedes and cancels retry behavior.
This property does not apply to map iterators.
static final java.lang.String PROPERTY_STRING_LABEL
It is good practice to include this property in every map create call. Monitoring data incorporates these labels so administrators can identify and distinguish among internal publishers and subscribers created on behalf of maps. Use labels that reveal the unique role and identity of each map within the application program.
When the map label is present in the map create call, the new map assigns it as the label of its internal publishers and subscribers.
Realm.createMap,
Constant Field Valuesvoid close()
throws FTLException
This call destroys only the local map object in the client process.
To delete the map from the persistence store, see
Realm.removeMap.
FTLExceptionvoid set(java.lang.String key,
Message value)
throws FTLException
If a value has already been set for the key, this call overwrites the existing value.
key - The call sets a value for this key.value - The call sets this value for the key.FTLExceptionvoid set(java.lang.String key,
Message value,
TibLock lock)
throws FTLException
Before its map operation, this call ensures that the process holds the lock. If the lock was previously held and then broken, this call fails until the lock is returned or a new lock object is supplied. Otherwise, if the process does not already hold the lock, this call acquires the lock for the process. If it cannot acquire the lock, this call throws an exception, and does not change the key's value.
If the process acquires the lock through this call, it retains the lock after the call completes. The process holds the lock until the lock is explicitly returned or the lock is broken. A disconnect from the persistence service or a call to steal the lock can break the lock owned by this process.
If a value has already been set for the key, this call overwrites the existing value.
key - The call sets a value for this key.value - The call sets this value for the key.lock - The call requires the lock represented by this lock object.FTLExceptionvoid set(java.lang.String[] keys,
Message[] values)
throws FTLException
If a value has already been set for a key, this call overwrites the existing value.
keys - The call sets values for these keys.values - The call sets these values for the corresponding keys.FTLExceptionvoid set(java.lang.String[] keys,
Message[] values,
TibLock lock)
throws FTLException
Before its map operation, this call ensures that the process holds the lock. If the lock was previously held and then broken, this call fails until the lock is returned or a new lock object is supplied. Otherwise, if the process does not already hold the lock, this call acquires the lock for the process. If it cannot acquire the lock, this call throws an exception, and does not change any values.
If the process acquires the lock through this call, it retains the lock after the call completes. The process holds the lock until the lock is explicitly returned or the lock is broken. A disconnect from the persistence service or a call to steal the lock can break the lock owned by this process.
If a value has already been set for a key, this call overwrites the existing value.
keys - The call sets values for these keys.values - The call sets these values the corresponding keys.lock - The call requires the lock represented by this lock object.FTLExceptionMessage get(java.lang.String key) throws FTLException
This call returns a copy of the stored message. Client program code accepts ownership of the message object. Client program code may pass this message to another program thread. Client program code must explicitly destroy the message object.
If the key is not set in the map,
this call returns null.
key - The call gets a value for this key.FTLExceptionMessage get(java.lang.String key, TibLock lock) throws FTLException
This call returns a copy of the stored message. Client program code accepts ownership of the message object. Client program code may pass this message to another program thread. Client program code must explicitly destroy the message object.
Before its map operation, this call ensures that the process holds the lock. If the lock was previously held and then broken, this call fails until the lock is returned or a new lock object is supplied. Otherwise, if the process does not already hold the lock, this call acquires the lock for the process. If it cannot acquire the lock, this call throws an exception.
If the process acquires the lock through this call, it retains the lock after the call completes. The process holds the lock until the lock is explicitly returned or the lock is broken. A disconnect from the persistence service or a call to steal the lock can break the lock owned by this process.
If the key is not set in the map,
this call returns null.
key - The call gets a value for this key.lock - The call requires the lock represented by this lock object.FTLExceptionvoid remove(java.lang.String key)
throws FTLException
key - The call removes this key.FTLExceptionvoid remove(java.lang.String key,
TibLock lock)
throws FTLException
Before its map operation, this call ensures that the process holds the lock. If the lock was previously held and then broken, this call fails until the lock is returned or a new lock object is supplied. Otherwise, if the process does not already hold the lock, this call acquires the lock for the process. If it cannot acquire the lock, this call throws an exception, and does not remove the key/value pair.
If the process acquires the lock through this call, it retains the lock after the call completes. The process holds the lock until the lock is explicitly returned or the lock is broken. A disconnect from the persistence service or a call to steal the lock can break the lock owned by this process.
key - The call removes this key.lock - The call requires the lock represented by this lock object.FTLExceptionvoid removeAll()
throws FTLException
This call does not destroy the map.
FTLExceptionvoid removeAll(TibLock lock) throws FTLException
Before its map operation, this call ensures that the process holds the lock. If the lock was previously held and then broken, this call fails until the lock is returned or a new lock object is supplied. Otherwise, if the process does not already hold the lock, this call acquires the lock for the process. If it cannot acquire the lock, this call throws an exception, and does not remove the key/value pairs.
If the process acquires the lock through this call, it retains the lock after the call completes. The process holds the lock until the lock is explicitly returned or the lock is broken. A disconnect from the persistence service or a call to steal the lock can break the lock owned by this process.
This call does not destroy the map.
lock - The call requires the lock represented by this lock object.FTLExceptionTibMapIterator createIterator(TibProperties props) throws FTLException
The iterator produces every key/value pair in the map.
props - Optional. Supply null to omit.
String matcher properties:
FTLExceptionTibMapIterator createIterator(TibLock lock, TibProperties props) throws FTLException
The iterator produces every key/value pair in the map.
Before creating an iterator, this call ensures that the process holds the lock. If the lock was previously held and then broken, this call fails until the lock is returned or a new lock object is supplied. Otherwise, if the process does not already hold the lock, this call acquires the lock for the process. If it cannot acquire the lock, this call throws an exception.
If the process acquires the lock through this call, it retains the lock after the call completes. The process holds the lock until the lock is explicitly returned or the lock is broken. A disconnect from the persistence service or a call to steal the lock can break the lock owned by this process.
Subsequent calls to advance the iterator require that the process hold the lock.
lock - The iterator uses the lock represented by this lock object.props - Optional. Supply null to omit.
String matcher properties:
props - Limit the iterator to only matches of the value to this string.
For all key/value pairs, supply null.FTLExceptionlong getSize()
throws FTLException
FTLExceptionlong getSize(TibLock lock) throws FTLException
Before its map operation, this call ensures that the process holds the lock. If the lock was previously held and then broken, this call fails until the lock is returned or a new lock object is supplied. Otherwise, if the process does not already hold the lock, this call acquires the lock for the process. If it cannot acquire the lock, this call throws an exception.
If the process acquires the lock through this call, it retains the lock after the call completes. The process holds the lock until the lock is explicitly returned or the lock is broken. A disconnect from the persistence service or a call to steal the lock can break the lock owned by this process.
lock - The call requires the lock represented by this lock object.FTLExceptionjava.lang.String name()
Message[] getMultiple(java.lang.String[] keys) throws FTLException
The values array will be populated by the library and returns. An entry of NULL in the values array means that no value is present for the key at the corresponding index of the keys array.
keys - The call gets values for the specfied keys.FTLExceptionMessage[] getMultiple(java.lang.String[] keys, TibLock tiblock) throws FTLException
The values array will be populated by the library and returned; An entry of NULL in the values array means that no value is present for the key at the corresponding index of the keys array. Before its map operation, this call ensures that the process holds the lock. If the lock was previously held and then broken, this call fails until the lock is returned or a new lock object is supplied. Otherwise, if the process does not already hold the lock, this call acquires the lock for the process. If it cannot acquire the lock, this call sets an exception, and does not return any values. If the process acquires the lock through this call, it retains the lock after the call completes. The process holds the lock until the lock is explicitly returned or the lock is broken. A disconnect from the persistence service or a call to steal the lock can break the lock owned by this process.
keys - The call gets values for the specfied keys.tiblock - The call requires the lock represented by this lock object.FTLExceptionvoid removeMultiple(java.lang.String[] keys)
throws FTLException
keys - The call removes the specified keys and their values.FTLExceptionvoid removeMultiple(java.lang.String[] keys,
TibLock tiblock)
throws FTLException
Before its map operation, this call ensures that the process holds the lock. If the lock was previously held and then broken, this call fails until the lock is returned or a new lock object is supplied. Otherwise, if the process does not already hold the lock, this call acquires the lock for the process. If it cannot acquire the lock, this call sets an exception, and does not return any values. If the process acquires the lock through this call, it retains the lock after the call completes. The process holds the lock until the lock is explicitly returned or the lock is broken. A disconnect from the persistence service or a call to steal the lock can break the lock owned by this process.
keys - The call removes the specified keys and their values.tiblock - The call requires the lock represented by this lock object.FTLException