This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Thread safe. | |
*/ | |
public class RestApiClient { | |
/** | |
* Creation of these Client instances is expensive, and according to its Javadoc, they | |
* should be shared. | |
*/ | |
private static ConcurrentMap<String, Client> hostMap = new ConcurrentHashMap<>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.google.common.base.Optional; | |
import com.google.common.collect.ImmutableMap; | |
import org.jetbrains.annotations.NotNull; | |
import java.util.HashMap; | |
import java.util.Locale; | |
import java.util.Map; | |
/* | |
* Source https://gist.github.com/phil-brown/8056700 |