Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import java.util.HashMap;

import java.util.Map;

public class Main {
    private final static Map<String, Integer> s_inprogress = new HashMap<String, Integer>();

    public final static boolean syncInProgress(String atype, String aname) {
        String key = inProgressKey(atype, aname);
        synchronized (s_inprogress) {
            Integer v = s_inprogress.get(key);
            if (v == null) {
                return false;
            }
            if (v.intValue() <= 0) {
                return false;
            }
            return true;
        }
    }

    private final static String inProgressKey(String atype, String aname) {
        return atype + ":" + aname;
    }
}