Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.util.concurrent.Semaphore;

public class Main {
    public static void waitForRelease(Semaphore semaphore) {
        try {
            semaphore.acquire();
        } catch (InterruptedException iex) {
            //ignore
        }
        semaphore.release();
    }

    public static void acquire(Semaphore semaphore) {
        try {
            semaphore.acquire();
        } catch (InterruptedException iex) {
            // ignore
        }
    }

    public static void acquire(Semaphore semaphore, int permits) {
        try {
            semaphore.acquire(permits);
        } catch (InterruptedException iex) {
            // ignore
        }
    }
}