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

bboss.org.jgroups.util.MyConcurrentLinkedQueue Maven / Gradle / Ivy

The newest version!
package bboss.org.jgroups.util;

import java.util.concurrent.ConcurrentLinkedQueue;

/**
 * @author Bela Ban
 * @version $Id$
 */
public class MyConcurrentLinkedQueue extends ConcurrentLinkedQueue {
    private static final long serialVersionUID=8832199198382745902L;

    public T poll(long timeout) {
        long target_time=System.currentTimeMillis() + timeout;
        T retval;

        do {
            retval=poll();
            if(retval != null)
                return retval;
        }
        while(target_time < System.currentTimeMillis());

        return retval;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy