public static void main(String[] args) throws InterruptedException {
		final ConditionBoundedBuffer buffer = new ConditionBoundedBuffer<Integer>();
		ExecutorService service = Executors.newCachedThreadPool();
		service.execute(new Runnable() {
			public void run()
			{
				int i = 100;
				Random rnd = new Random(System.currentTimeMillis());
				do {
					try {
						buffer.put(new Integer(i));
						System.out.println("put value : " + i);
						TimeUnit.SECONDS.sleep(rnd.nextInt(10));
					} catch (InterruptedException e) {
						e.printStackTrace();
					}
				} while (i-- > 0);
			}
		});
		
		service.execute(new Runnable() {
			public void run()
			{
				Random rnd = new Random(System.currentTimeMillis() * 2);
				int i = 100;
				do {
					try {
						Integer v = (Integer) buffer.take();
						System.out.println("get value : " + v);
						TimeUnit.SECONDS.sleep(rnd.nextInt(10));
					} catch (InterruptedException e) {
						e.printStackTrace();
					}
				} while (i-- > 0);
			}
		});
		service.awaitTermination(1000, TimeUnit.SECONDS);
	}