public void releaseVM(SlaveVM vm) {
		System.out.println("DEBUG: VM " + vm.getId() + " is available again");
		vm.setState(VMState.WAITING);
		this.vmsInUse.remove(vm);
		this.vmsAvailable.add(vm);

		final int id = vm.getId();

		Thread timeout = new Thread() {
			public void run() {
				try {
					Thread.sleep(ResourcePool.VM_TIMEOUT);
				} catch (InterruptedException e) {
				}
				synchronized (vmsAvailable) {
					// always keep one VM alive
					if (availableVMCount() > 1) {

						removeVM(allVms.get(id));
					}
				}
			}
		};
		timeout.start();

	}