Example usage for io.vertx.core.shareddata SharedData getLockWithTimeout

List of usage examples for io.vertx.core.shareddata SharedData getLockWithTimeout

Introduction

In this page you can find the example usage for io.vertx.core.shareddata SharedData getLockWithTimeout.

Prototype

void getLockWithTimeout(String name, long timeout, Handler<AsyncResult<Lock>> resultHandler);

Source Link

Document

Like #getLock(String,Handler) but specifying a timeout.

Usage

From source file:examples.SharedDataExamples.java

License:Open Source License

public void example6(SharedData sd) {
    sd.getLockWithTimeout("mylock", 10000, res -> {
        if (res.succeeded()) {
            // Got the lock!
            Lock lock = res.result();

        } else {/*from  www .  j  ava  2  s  . co  m*/
            // Failed to get lock
        }
    });
}