boolean runTransaction()
	{
		abortTransaction = false;
		lockedResources.clear();
		owner.println("Starting transaction " + transactionId + '.', transactionId);

		// Figure out how many resource accesses the transaction consists of.
		int nofAccesses = Globals.random(Globals.MIN_NOF_ACCESSES_PER_TRANSACTION, Globals.MAX_NOF_ACCESSES_PER_TRANSACTION);
		if (input != null) {
			// Read the number of accesses from the input file instead.
			// Expected format: NUMBER OF ACCESSES: 7
			String line = input.readLine();
			if (line == null || !line.startsWith("NUMBER OF ACCESSES: ")) {
				System.out.println("ERROR: Input file is incorrectly formatted. Program aborted.");
				System.exit(1);
			}
			nofAccesses = Integer.parseInt(line.substring(20));
		}

		// Perform the accesses
		for (int i = 0; i < nofAccesses; i++) {
			ResourceAccess nextResource = getNextResource();
			abortTransaction = !acquireLock(nextResource);
			if (abortTransaction) {
				// Transaction should abort due to a communication failure
				abort();
				return false;
			}
			else {
				owner.println("Lock claimed. Processing...", transactionId);
				processResource();
			}
		}
		commit();
		return true;
	}