synchronized boolean lock(int transactionId, int resourceId, ServerImpl serverimpl)
	{
		if (lockOwner == transactionId) {
			System.err.println("Error: Transaction " + transactionId + " tried to lock a resource it already has locked!");
			return false;
		}
		long timeout_time = Globals.TIMEOUT_INTERVAL + System.currentTimeMillis();
		while (lockOwner != NOT_LOCKED) {
			try {
				if (Globals.PROBING_ENABLED) {
					Server server = serverimpl.getServer(ServerImpl.getTransactionOwner(lockOwner));
					ProbeMessage probeMessage = new ProbeMessage(transactionId, new ArrayList<Integer>(), server, resourceId);
					probeMessage.start();
					try {
						wait();
					} catch (InterruptedException e) {
						//nothing to see here...
					}
					System.out.println("abortid" + abortTransactionID + " tranid " + transactionId);
					if(abortTransactionID == transactionId){
						System.out.println("false hehehhehehe");
						abortTransactionID = -1;
						return false;
					}
				}
				//If timeout
				else {
					System.out.println("jaja");
					wait(timeout_time - System.currentTimeMillis());
				}
				if(System.currentTimeMillis() >= timeout_time){
					return false;
				}
			} catch (InterruptedException ie) {
				System.out.println("HALLA");
			}
		}

		lockOwner = transactionId;
		return true;
	}