public void run(){
			//Run until interrupted.
			while(true){
				try{
					System.out.println("processing");
					ref = queue.remove();//ref:reference to a key
					res = null;
					synchronized(ResourceManager.this){
						res = refs.get(ref);//res:an object mapping by the key of "ref"
						refs.remove(ref);
					}
					res.release();
					ref.clear();
				}catch(InterruptedException ex){//Only in the case of waiting in the middle of "remove()".
					ex.printStackTrace();
					System.out.println("interrupted");
					//do nothing
				}
				finally{
					if(shutdown){
						while(true){
							if(queue.poll() != null){//Without this, this thread may stop in the process of "remove()".
								try {
									ref = queue.remove();
								} catch (InterruptedException e) {
									e.printStackTrace();
								}//ref:reference to a key
								res = null;
								synchronized(ResourceManager.this){
									res = refs.get(ref);//res:an object mapping by the key of "ref"
									refs.remove(ref);
								}
								res.release();
								ref.clear();
							}
							else{//Wrong. Check if the size of ref is equal to 0. Whether queue is null is not a condition to terminate the system.
								System.out.println("break");
								break;
							}
						}
						System.out.println("break");
						break;
					}
				}
			}
			System.out.println("end");	
		}