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; public class Main { public static <E> void surePut(BlockingQueue<E> q, E el) { while (true) { try { q.put(el); break; } catch (InterruptedException e) { } } } }