Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
// This software is released under the Apache License 2.0.

import java.util.concurrent.*;

public class Main {
    public static void sync(CountDownLatch barrier, long timeoutMillis) {
        barrier.countDown();
        await(barrier, timeoutMillis);
    }

    public static void await(CountDownLatch barrier, long timeoutMillis) {
        try {
            barrier.await(timeoutMillis, TimeUnit.MILLISECONDS);
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
        }
    }
}