Java tutorial
//package com.java2s; /** * This class is part of JCodec ( www.jcodec.org ) This software is distributed * under FreeBSD License * * @author The JCodec project * */ import java.util.concurrent.BlockingQueue; import java.util.concurrent.TimeUnit; public class Main { public static <T> T take(BlockingQueue<T> videoDrain, int ms) { try { return videoDrain.poll(ms, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { return null; } } }