Example usage for io.vertx.core.shareddata Lock release

List of usage examples for io.vertx.core.shareddata Lock release

Introduction

In this page you can find the example usage for io.vertx.core.shareddata Lock release.

Prototype

void release();

Source Link

Document

Release the lock.

Usage

From source file:examples.SharedDataExamples.java

License:Open Source License

public void example5(Vertx vertx, SharedData sd) {
    sd.getLock("mylock", res -> {
        if (res.succeeded()) {
            // Got the lock!
            Lock lock = res.result();

            // 5 seconds later we release the lock so someone else can get it

            vertx.setTimer(5000, tid -> lock.release());

        } else {//  w  ww.j a  v  a 2  s .c  o  m
            // Something went wrong
        }
    });
}