Example usage for io.vertx.core Context isOnVertxThread

List of usage examples for io.vertx.core Context isOnVertxThread

Introduction

In this page you can find the example usage for io.vertx.core Context isOnVertxThread.

Prototype

static boolean isOnVertxThread() 

Source Link

Document

Is the current thread a Vert.x thread?

Usage

From source file:examples.CoreExamples.java

License:Open Source License

public void retrieveContextType(Vertx vertx) {
    Context context = vertx.getOrCreateContext();
    if (context.isEventLoopContext()) {
        System.out.println("Context attached to Event Loop");
    } else if (context.isWorkerContext()) {
        System.out.println("Context attached to Worker Thread");
    } else if (context.isMultiThreadedWorkerContext()) {
        System.out.println("Context attached to Worker Thread - multi threaded worker");
    } else if (!Context.isOnVertxThread()) {
        System.out.println("Context not attached to a thread managed by vert.x");
    }//from w w w .  ja  v a  2 s . c  o  m
}