Example usage for io.vertx.core.shareddata AsyncMap putIfAbsent

List of usage examples for io.vertx.core.shareddata AsyncMap putIfAbsent

Introduction

In this page you can find the example usage for io.vertx.core.shareddata AsyncMap putIfAbsent.

Prototype

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

Source Link

Document

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

Usage

From source file:io.github.jdocker.serviceregistry.ServiceRegistry.java

License:Apache License

private void putToClusteredMap(Endpoint endpoin, SharedData sd) {
    sd.<String, String>getClusterWideMap(REG_NAME, res -> {
        if (res.succeeded()) {
            AsyncMap<String, String> map = res.result();
            map.putIfAbsent(endpoin.getServiceName(), Json.encode(endpoin), result -> {
                if (result.succeeded()) {

                } else {
                    // Something went wrong!
                }//  w  w  w.jav  a2s  .com
            });
        } else {
            // Something went wrong!
        }
    });
}