Code example for ReferenceQueue

0
	final Thread reaper;
	boolean shutdown = false;
	 
	 
	public ResourceManager() { 
		queue = new ReferenceQueue<Object>();
		refs = new HashMap<Reference<?>, Resource>();
		reaper = new ReaperThread();
		reaper.start();
	} 
	 
	 
	public synchronized void shutdown() { 
		if (!shutdown) {
			shutdown = true;
		} 
	} 
	 
	 
	public synchronized Resource getResource(Object key) {
		if (shutdown)