public static void main(String[] args) throws InterruptedException, ExecutionException {
        final SynchronousQueue<Integer> queue = new SynchronousQueue<Integer>();


        new Thread() {
            @Override
            public void run() {
                try {
                    while (running) {
                        System.out.println("size1:" + queue.size());
                        sleep(1000);
                        //System.out.println("element:" + queue.take());
                        //System.out.println("size2:" + queue.size());
                    }
                } catch (/*Interrupted*/Exception e) {

                    e.printStackTrace();
                }
            }
        }.start();


        queue.put(1);
        queue.put(2);
        queue.put(3);
        //*4
        ScheduledExecutorService service= Executors.newScheduledThreadPool(1);
        ScheduledFuture future2=service.schedule(new Callable()
        {
            public String call() throws InterruptedException {
                running = false;
                return "taskcancelled!";
            }
        },5, TimeUnit.SECONDS);
        System.out.println(future2.get());
    }