Top Description Methods
io.vertx.core.shareddata

public Interface AsyncMap<K, V>

Known Direct Implementers
io.vertx.core.shareddata.impl.LocalAsyncMapImpl, io.vertx.core.shareddata.impl.SharedDataImpl.WrappedAsyncMap
Annotations
@VertxGen
Imports
io.vertx.codegen.annotations.GenIgnore, .Nullable, .VertxGen, io.vertx.core.AsyncResult, .Future, .Handler, java.util.List, .Map, .Set

An asynchronous map.

AsyncMap does not allow null to be used as a key or value.

Implementation Specification

Implementations of the interface must handle io.vertx.core.shareddata.ClusterSerializable implementing objects.

Author
Tim Fox

Method Summary

Modifier and TypeMethod and Description
public default void
clear(Handler<AsyncResult<Void>>
called on completion
resultHandler
)

Clear all entries in the map

public Future<Void>
clear()

Same as clear(Handler) but returns a Future of the asynchronous result

public default void
entries(Handler<AsyncResult<Map<K, V>>>
invoked when the operation completes
resultHandler
)

Get the entries of the map, asynchronously.

public Future<Map<K, V>>
entries()

Same as entries(Handler) but returns a Future of the asynchronous result

public default void
get(K
the key
k
,
Handler<AsyncResult<@Nullable V>>
- this will be called some time later with the async result.
resultHandler
)

Get a value from the map, asynchronously.

public Future<@Nullable V>
get(K k)

Same as get(K, Handler) but returns a Future of the asynchronous result

public default void
keys(Handler<AsyncResult<Set<K>>>
invoked when the operation completes
resultHandler
)

Get the keys of the map, asynchronously.

public Future<Set<K>>
keys()

Same as keys(Handler) but returns a Future of the asynchronous result

public default void
put(K
the key
k
,
V
the value
v
,
Handler<AsyncResult<Void>>
- this will be called some time later to signify the value has been put
completionHandler
)

Put a value in the map, asynchronously.

public Future<Void>
put(K k, V v)

Same as put(K, V, Handler) but returns a Future of the asynchronous result

public default void
put(K
the key
k
,
V
the value
v
,
long
The time to live (in ms) for the entry
ttl
,
Handler<AsyncResult<Void>>
the handler
completionHandler
)

Like put but specifying a time to live for the entry.

public Future<Void>
put(K k, V v, long ttl)

Same as put(K, V, long, Handler) but returns a Future of the asynchronous result

public default void
putIfAbsent(K
the key
k
,
V
the value
v
,
Handler<AsyncResult<@Nullable V>>
the handler
completionHandler
)

Put the entry only if there is no entry with the key already present.

public Future<@Nullable V>
putIfAbsent(K k, V v)

Same as putIfAbsent(K, V, Handler) but returns a Future of the asynchronous result

public default void
putIfAbsent(K
the key
k
,
V
the value
v
,
long
The time to live (in ms) for the entry
ttl
,
Handler<AsyncResult<@Nullable V>>
the handler
completionHandler
)

Link putIfAbsent but specifying a time to live for the entry.

public Future<@Nullable V>
putIfAbsent(K k, V v, long ttl)

Same as putIfAbsent(K, V, long, Handler) but returns a Future of the asynchronous result

public default void
remove(K
the key
k
,
Handler<AsyncResult<@Nullable V>>
- this will be called some time later to signify the value has been removed
resultHandler
)

Remove a value from the map, asynchronously.

public Future<@Nullable V>
remove(K k)

Same as remove(K, Handler) but returns a Future of the asynchronous result

public default void
removeIfPresent(K
the key
k
,
V
the value
v
,
Handler<AsyncResult<Boolean>>
- this will be called some time later to signify the value has been removed
resultHandler
)

Remove a value from the map, only if entry already exists with same value.

public Future<Boolean>
removeIfPresent(K k, V v)

Same as removeIfPresent(K, V, Handler) but returns a Future of the asynchronous result

public default void
replace(K
the key
k
,
V
the new value
v
,
Handler<AsyncResult<@Nullable V>>
the result handler will be passed the previous value
resultHandler
)

Replace the entry only if it is currently mapped to some value

public Future<@Nullable V>
replace(K k, V v)

Same as replace(K, V, Handler) but returns a Future of the asynchronous result

public default void
replace(K
the key
k
,
V
the new value
v
,
long
The time to live (in ms) for the entry
ttl
,
Handler<AsyncResult<@Nullable V>>
the result handler will be passed the previous value
resultHandler
)

Replace the entry only if it is currently mapped to some value

public default Future<@Nullable V>
replace(K k, V v, long ttl)

Same as replace(K, V, long, Handler) but returns a Future of the asynchronous result returns UnsupportedOperationException if the implementation does not support it

public default void
replaceIfPresent(K
the key
k
,
V
the existing value
oldValue
,
V
the new value
newValue
,
Handler<AsyncResult<Boolean>>
the result handler
resultHandler
)

Replace the entry only if it is currently mapped to a specific value

public Future<Boolean>
replaceIfPresent(K k, V oldValue, V newValue)

Same as replaceIfPresent(K, V, V, Handler) but returns a Future of the asynchronous result

public default void
replaceIfPresent(K
the key
k
,
V
the existing value
oldValue
,
V
the new value
newValue
,
long
The time to live (in ms) for the entry
ttl
,
Handler<AsyncResult<Boolean>>
the result handler
resultHandler
)

Replace the entry only if it is currently mapped to a specific value

public default Future<Boolean>
replaceIfPresent(K k, V oldValue, V newValue, long ttl)

Same as replaceIfPresent(K, V, V, long, Handler) but returns a Future of the asynchronous result returns UnsupportedOperationException if the implementation does not support it

public default void
size(Handler<AsyncResult<Integer>>
handler which will receive the number of entries
resultHandler
)

Provide the number of entries in the map

public Future<Integer>
size()

Same as size(Handler) but returns a Future of the asynchronous result

public default void
values(Handler<AsyncResult<List<V>>>
invoked when the operation completes
resultHandler
)

Get the values of the map, asynchronously.

public Future<List<V>>
values()

Same as values(Handler) but returns a Future of the asynchronous result

Method Detail

clearback to summary
public default void clear(Handler<AsyncResult<Void>> resultHandler)

Clear all entries in the map

Parameters
resultHandler:Handler<AsyncResult<Void>>

called on completion

clearback to summary
public Future<Void> clear()

Same as clear(Handler) but returns a Future of the asynchronous result

entriesback to summary
public default void entries(Handler<AsyncResult<Map<K, V>>> resultHandler)

Get the entries of the map, asynchronously.

Use this method with care as the map may contain a large number of entries, which may not fit entirely in memory of a single node. In this case, the invocation will result in an OutOfMemoryError.

Parameters
resultHandler:Handler<AsyncResult<Map<K, V>>>

invoked when the operation completes

Annotations
@GenIgnore
entriesback to summary
public Future<Map<K, V>> entries()

Same as entries(Handler) but returns a Future of the asynchronous result

Annotations
@GenIgnore
getback to summary
public default void get(K k, Handler<AsyncResult<@Nullable V>> resultHandler)

Get a value from the map, asynchronously.

Parameters
k:K

the key

resultHandler:Handler<AsyncResult<@Nullable V>>

- this will be called some time later with the async result.

getback to summary
public Future<@Nullable V> get(K k)

Same as get(K, Handler) but returns a Future of the asynchronous result

keysback to summary
public default void keys(Handler<AsyncResult<Set<K>>> resultHandler)

Get the keys of the map, asynchronously.

Use this method with care as the map may contain a large number of keys, which may not fit entirely in memory of a single node. In this case, the invocation will result in an OutOfMemoryError.

Parameters
resultHandler:Handler<AsyncResult<Set<K>>>

invoked when the operation completes

Annotations
@GenIgnore:permitted-type
keysback to summary
public Future<Set<K>> keys()

Same as keys(Handler) but returns a Future of the asynchronous result

Annotations
@GenIgnore:permitted-type
putback to summary
public default void put(K k, V v, Handler<AsyncResult<Void>> completionHandler)

Put a value in the map, asynchronously.

Parameters
k:K

the key

v:V

the value

completionHandler:Handler<AsyncResult<Void>>

- this will be called some time later to signify the value has been put

putback to summary
public Future<Void> put(K k, V v)

Same as put(K, V, Handler) but returns a Future of the asynchronous result

putback to summary
public default void put(K k, V v, long ttl, Handler<AsyncResult<Void>> completionHandler)

Like put but specifying a time to live for the entry. Entry will expire and get evicted after the ttl.

Parameters
k:K

the key

v:V

the value

ttl:long

The time to live (in ms) for the entry

completionHandler:Handler<AsyncResult<Void>>

the handler

putback to summary
public Future<Void> put(K k, V v, long ttl)

Same as put(K, V, long, Handler) but returns a Future of the asynchronous result

putIfAbsentback to summary
public default void putIfAbsent(K k, V v, Handler<AsyncResult<@Nullable V>> completionHandler)

Put the entry only if there is no entry with the key already present. If key already present then the existing value will be returned to the handler, otherwise null.

Parameters
k:K

the key

v:V

the value

completionHandler:Handler<AsyncResult<@Nullable V>>

the handler

putIfAbsentback to summary
public Future<@Nullable V> putIfAbsent(K k, V v)

Same as putIfAbsent(K, V, Handler) but returns a Future of the asynchronous result

putIfAbsentback to summary
public default void putIfAbsent(K k, V v, long ttl, Handler<AsyncResult<@Nullable V>> completionHandler)

Link putIfAbsent but specifying a time to live for the entry. Entry will expire and get evicted after the ttl.

Parameters
k:K

the key

v:V

the value

ttl:long

The time to live (in ms) for the entry

completionHandler:Handler<AsyncResult<@Nullable V>>

the handler

putIfAbsentback to summary
public Future<@Nullable V> putIfAbsent(K k, V v, long ttl)

Same as putIfAbsent(K, V, long, Handler) but returns a Future of the asynchronous result

removeback to summary
public default void remove(K k, Handler<AsyncResult<@Nullable V>> resultHandler)

Remove a value from the map, asynchronously.

Parameters
k:K

the key

resultHandler:Handler<AsyncResult<@Nullable V>>

- this will be called some time later to signify the value has been removed

removeback to summary
public Future<@Nullable V> remove(K k)

Same as remove(K, Handler) but returns a Future of the asynchronous result

removeIfPresentback to summary
public default void removeIfPresent(K k, V v, Handler<AsyncResult<Boolean>> resultHandler)

Remove a value from the map, only if entry already exists with same value.

Parameters
k:K

the key

v:V

the value

resultHandler:Handler<AsyncResult<Boolean>>

- this will be called some time later to signify the value has been removed

removeIfPresentback to summary
public Future<Boolean> removeIfPresent(K k, V v)

Same as removeIfPresent(K, V, Handler) but returns a Future of the asynchronous result

replaceback to summary
public default void replace(K k, V v, Handler<AsyncResult<@Nullable V>> resultHandler)

Replace the entry only if it is currently mapped to some value

Parameters
k:K

the key

v:V

the new value

resultHandler:Handler<AsyncResult<@Nullable V>>

the result handler will be passed the previous value

replaceback to summary
public Future<@Nullable V> replace(K k, V v)

Same as replace(K, V, Handler) but returns a Future of the asynchronous result

replaceback to summary
public default void replace(K k, V v, long ttl, Handler<AsyncResult<@Nullable V>> resultHandler)

Replace the entry only if it is currently mapped to some value

Parameters
k:K

the key

v:V

the new value

ttl:long

The time to live (in ms) for the entry

resultHandler:Handler<AsyncResult<@Nullable V>>

the result handler will be passed the previous value

replaceback to summary
public default Future<@Nullable V> replace(K k, V v, long ttl)

Same as replace(K, V, long, Handler) but returns a Future of the asynchronous result returns UnsupportedOperationException if the implementation does not support it

replaceIfPresentback to summary
public default void replaceIfPresent(K k, V oldValue, V newValue, Handler<AsyncResult<Boolean>> resultHandler)

Replace the entry only if it is currently mapped to a specific value

Parameters
k:K

the key

oldValue:V

the existing value

newValue:V

the new value

resultHandler:Handler<AsyncResult<Boolean>>

the result handler

replaceIfPresentback to summary
public Future<Boolean> replaceIfPresent(K k, V oldValue, V newValue)

Same as replaceIfPresent(K, V, V, Handler) but returns a Future of the asynchronous result

replaceIfPresentback to summary
public default void replaceIfPresent(K k, V oldValue, V newValue, long ttl, Handler<AsyncResult<Boolean>> resultHandler)

Replace the entry only if it is currently mapped to a specific value

Parameters
k:K

the key

oldValue:V

the existing value

newValue:V

the new value

ttl:long

The time to live (in ms) for the entry

resultHandler:Handler<AsyncResult<Boolean>>

the result handler

replaceIfPresentback to summary
public default Future<Boolean> replaceIfPresent(K k, V oldValue, V newValue, long ttl)

Same as replaceIfPresent(K, V, V, long, Handler) but returns a Future of the asynchronous result returns UnsupportedOperationException if the implementation does not support it

sizeback to summary
public default void size(Handler<AsyncResult<Integer>> resultHandler)

Provide the number of entries in the map

Parameters
resultHandler:Handler<AsyncResult<Integer>>

handler which will receive the number of entries

sizeback to summary
public Future<Integer> size()

Same as size(Handler) but returns a Future of the asynchronous result

valuesback to summary
public default void values(Handler<AsyncResult<List<V>>> resultHandler)

Get the values of the map, asynchronously.

Use this method with care as the map may contain a large number of values, which may not fit entirely in memory of a single node. In this case, the invocation will result in an OutOfMemoryError.

Parameters
resultHandler:Handler<AsyncResult<List<V>>>

invoked when the operation completes

Annotations
@GenIgnore:permitted-type
valuesback to summary
public Future<List<V>> values()

Same as values(Handler) but returns a Future of the asynchronous result

Annotations
@GenIgnore:permitted-type