Java tutorial
//package com.java2s; import java.util.concurrent.ConcurrentHashMap; public class Main { private static ConcurrentHashMap<String, String> publicDnsMap; public static synchronized ConcurrentHashMap<String, String> getMap() { if (publicDnsMap == null) { publicDnsMap = new ConcurrentHashMap<String, String>(); } return publicDnsMap; } }