@SuppressWarnings("unchecked")
	public synchronized Resource getResource(Object key){//How can I get the referent from the key? I'd like to check if the specified referent has been enqueued.
		if(shutdown)
			throw new IllegalStateException();
		
		boolean keyAvailable = true;
		
		while(true){
			PhantomReference<Object> ref;
			Resource res = null;
			if((ref = (PhantomReference<Object>) queue.poll()) != null){
				res = refs.get(ref);//"ref" is no longer available.
				refs.remove(ref);
				if(res != null){
					keyAvailable = false;
					res.release();
				}
					ref.clear();//Then, "key" referred to by "ref" is retrieved.
			}
			else//There is no key to be retrieved.
				break;
		}
		if(keyAvailable){
			Resource res = new ResourceImpl(key);
			Reference<?> ref = new PhantomReference<Object>(key, queue);//It is possible to get the object by way of "ref" from the key.
			refs.put(ref, res);
			return res;
		}
		//key is not available
		return null;
	}