This file contains hidden or 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 java.util.LinkedList; | |
import java.util.List; | |
import java.util.Queue; | |
/* | |
* A solution using Proxy Pattern to limited instances problem | |
* Requirement: | |
* class RareResource must have no more than 3 instances at any run time. | |
* Note: | |
* Black magic like reflection is out of consideration as you can never prevent it. |