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

com.kolibrifx.mq.core.ImmediateFuture Maven / Gradle / Ivy

Go to download

Core interfaces for a message bus based on topics, and an in-process implementation.

The newest version!
/*
 * Copyright (c) 2010-2017, KolibriFX AS. Licensed under the Apache License, version 2.0.
 */

package com.kolibrifx.mq.core;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

public class ImmediateFuture implements Future {
    T t;

    public ImmediateFuture(final T t) {
        this.t = t;
    }

    @Override
    public boolean cancel(final boolean mayInterruptIfRunning) {
        return false;
    }

    @Override
    public T get() throws InterruptedException, ExecutionException {
        return t;
    }

    @Override
    public T get(final long timeout, final TimeUnit unit)
        throws InterruptedException, ExecutionException, TimeoutException {
        return t;
    }

    @Override
    public boolean isCancelled() {
        return false;
    }

    @Override
    public boolean isDone() {
        return true;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy