Example usage for io.vertx.core Context isWorkerContext

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

Introduction

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

Prototype

boolean isWorkerContext();

Source Link

Document

Is the current context a worker context?

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");
    }//w w  w  . j  a  va2 s .co  m
}