public static void main(String[] args) {;
		boolean res;

		// --

		/*System.out.println("Trying to perform transaction (using doTransactionally)");

		res = Transaction.doTransactionally(new Callable<Boolean>() {
			public Boolean call() {
				x = 1;
				y = 1;
				return true;
			}
		}, new Callable<Boolean>() {
			public Boolean call() {
				return false;
			}
		});

		System.out.println("Transaction result: " + res + " (x: " + x + ", y: " + y + ")");*/

		// --

		/*System.out.println("Testing abort (using doTransactionally)");

		res = Transaction.doTransactionally(new Callable<Boolean>() {
			public Boolean call() {
				Transaction.abort();
				throw new AssertionError("Should never happen");
			}
		}, new Callable<Boolean>() {
			public Boolean call() {
				System.out.println("fallbackBlock!");
				return true;
			}
		});

		System.out.println("Transaction result: " + res + " (x: " + x + ", y: " + y + ")");*/

		// --

		System.out.println("Trying to perform transaction (using manual API)");

		res = false;

		int txStatus = Transaction.begin();
		if (txStatus == Transaction.STARTED) {
			x = 2;
			y = 2;
			res = true;
			Transaction.commit();
		}

		System.out.println("Transaction result: " + res + " (x: " + x + ", y: " + y + ", txStatus: " + txStatus + ")");

		// --

		System.out.println("----------");
		System.out.println("Trying abort(0 -> 255)");
		int statusZero = 0;
		int retry = 0;
		int capacity = 0;
		for (int i = 0; i <= 255; i++) {
			txStatus = Transaction.begin();
			if (txStatus == Transaction.STARTED) {
				Transaction.abort(i);
			}
			if (txStatus == Transaction.ABORT_CAPACITY) {
				capacity++;
			} else if (((txStatus & Transaction.ABORT_EXPLICIT) != 0) && (Transaction.getAbortReason(txStatus) != i)) {
				System.out.println("Unexpected txStatus for i: " + i + " txStatus: " + txStatus);
			} else if (txStatus == 0) {
				statusZero++;
			} else if ((txStatus & Transaction.ABORT_RETRY) != 0) {
				retry++;
			} else if ((txStatus & Transaction.ABORT_EXPLICIT) == 0) {
				System.out.println("Unexpected txStatus for i: " + i + " txStatus: " + txStatus + " (bit 0 unset)");
			}
		}
		System.out.println("abort(0 -> 255) results: " + (255 - statusZero - retry - capacity) +
				" correct status codes; " + statusZero + " times status == 0; " + retry +
				" may retry; " + capacity + " capacity aborts");

		// --

		System.out.println("----------");
		System.out.println("Finished testing!");
	}