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

com.oracle.coherence.common.base.Pollable Maven / Gradle / Ivy

There is a newer version: 24.09
Show newest version
/*
 * Copyright (c) 2000, 2020, Oracle and/or its affiliates.
 *
 * Licensed under the Universal Permissive License v 1.0 as shown at
 * http://oss.oracle.com/licenses/upl.
 */
package com.oracle.coherence.common.base;

import java.util.concurrent.TimeUnit;

/**
 * The Pollable interface describes a component which supports element removal.
 *
 * @author mf  2013.02.19
 */
public interface Pollable
    {
    /**
     * Removes and returns the next element, or returns null if none is present.
     *
     * @return the next element or null
     */
    E poll();

    /**
     * Removes and returns the next element, or returns null upon timeout.
     *
     * @param timeout how long to wait before giving up, in units of
     *        unit
     * @param unit a TimeUnit determining how to interpret the
     *        timeout parameter
     *
     * @return the next element or null
     * @throws InterruptedException if interrupted while waiting
     */
    E poll(long timeout, TimeUnit unit)
            throws InterruptedException;
    }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy