All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.vertx.core.impl.DuplicatedContext Maven / Gradle / Ivy

There is a newer version: 5.0.0.CR1
Show newest version
/*
 * Copyright (c) 2011-2020 Contributors to the Eclipse Foundation
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License 2.0 which is available at
 * http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
 * which is available at https://www.apache.org/licenses/LICENSE-2.0.
 *
 * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
 */
package io.vertx.core.impl;

import io.netty.channel.EventLoop;
import io.vertx.core.*;
import io.vertx.core.json.JsonObject;
import io.vertx.core.spi.tracing.VertxTracer;

import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.Executor;

/**
 * A context that forwards most operations to a delegate. This context
 *
 * 
    *
  • maintains its own local data instead of the delegate.
  • *
* * @author Julien Viet */ final class DuplicatedContext extends ContextBase implements ContextInternal { final ContextImpl delegate; DuplicatedContext(ContextImpl delegate) { super(delegate); this.delegate = delegate; } @Override public ThreadingModel threadingModel() { return delegate.threadingModel(); } @Override public boolean inThread() { return delegate.inThread(); } @Override public final CloseFuture closeFuture() { return delegate.closeFuture(); } @Override public final VertxTracer tracer() { return delegate.tracer(); } @Override public final JsonObject config() { return delegate.config(); } @Override public final Context exceptionHandler(Handler handler) { delegate.exceptionHandler(handler); return this; } @Override public Executor executor() { return delegate.executor(); } @Override public final Handler exceptionHandler() { return delegate.exceptionHandler(); } @Override public final EventLoop nettyEventLoop() { return delegate.nettyEventLoop(); } @Override public final Deployment getDeployment() { return delegate.getDeployment(); } @Override public final VertxInternal owner() { return delegate.owner(); } @Override public final ClassLoader classLoader() { return delegate.classLoader(); } @Override public WorkerPool workerPool() { return delegate.workerPool(); } @Override public final void reportException(Throwable t) { delegate.reportException(t); } @Override public final ConcurrentMap contextData() { return delegate.contextData(); } @Override public final Future executeBlockingInternal(Handler> action) { return ContextImpl.executeBlocking(this, action, delegate.internalWorkerPool, delegate.internalOrderedTasks); } @Override public Future executeBlockingInternal(Callable action) { return ContextImpl.executeBlocking(this, action, delegate.internalWorkerPool, delegate.internalOrderedTasks); } @Override public final Future executeBlockingInternal(Handler> action, boolean ordered) { return ContextImpl.executeBlocking(this, action, delegate.internalWorkerPool, ordered ? delegate.internalOrderedTasks : null); } @Override public Future executeBlockingInternal(Callable action, boolean ordered) { return ContextImpl.executeBlocking(this, action, delegate.internalWorkerPool, ordered ? delegate.internalOrderedTasks : null); } @Override public final Future executeBlocking(Handler> action, boolean ordered) { return ContextImpl.executeBlocking(this, action, delegate.workerPool, ordered ? delegate.orderedTasks : null); } @Override public final Future executeBlocking(Callable blockingCodeHandler, boolean ordered) { return ContextImpl.executeBlocking(this, blockingCodeHandler, delegate.workerPool, ordered ? delegate.orderedTasks : null); } @Override public final Future executeBlocking(Handler> blockingCodeHandler, TaskQueue queue) { return ContextImpl.executeBlocking(this, blockingCodeHandler, delegate.workerPool, queue); } @Override public final Future executeBlocking(Callable blockingCodeHandler, TaskQueue queue) { return ContextImpl.executeBlocking(this, blockingCodeHandler, delegate.workerPool, queue); } @Override public final void execute(T argument, Handler task) { delegate.execute(this, argument, task); } @Override public void emit(T argument, Handler task) { delegate.emit(this, argument, task); } @Override public void execute(Runnable task) { delegate.execute(this, task); } @Override public boolean isEventLoopContext() { return delegate.isEventLoopContext(); } @Override public boolean isWorkerContext() { return delegate.isWorkerContext(); } @Override public ContextInternal duplicate() { return new DuplicatedContext(delegate); } @Override public ContextInternal unwrap() { return delegate; } @Override public boolean isDuplicate() { return true; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy