private void phaser() {
        int count = 4;

        final Phaser phaser = new Phaser();
        phaser.register();

        for (int i = 0; i < count; i++) {
            phaser.register();
            final int localCount = i;

            new Thread(new Runnable() {
                public void run() {
                    try {
                        Thread.sleep(localCount * 1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                    System.out.println(localCount);
                    phaser.arrive();
                }
            }).start();
        }
    }