boolean commit(Transaction t){
		//check if commitable.
		ArrayList<String> names=new ArrayList<String>();
		
		for(String variable:lockTable.keySet()){
			if(lockTable.get(variable).equals(t)){
				names.add(variable);
			}
		}
		
		for(String variable:names){
			variablesBackup.get(variable).setValue(variables.get(variable).getValue());
			variables.put(variable,variablesBackup.get(variable));//Restore the original variable object in variables map.
			lockTable.remove(variable);
		}
		
		for(String var:readLockTable.keySet()){
			readLockTable.get(var).remove(t);
		}
		
		List<String> tempVariableList = new ArrayList<String>(readLockTable.keySet());
		for(String var:tempVariableList){
			if(readLockTable.get(var).size()==0)
				readLockTable.remove(var);
		}
		
		return true;
	}