public static void countWithStateless() throws NamingException, InterruptedException {
		
		int i, lostTimes = 0;
		long threadId = Thread.currentThread().getId();
		RemoteSLSB slb = lookupRemoteSLSB();
		boolean lost = false;
		
		System.out.println(threadId + ": Obtained a remote stateless bean for invocation.");
		long time = System.nanoTime();

		for (i = 1; i <= Variables.repeat; i++) {
			try {
				slb.getMessage();
			} catch (Exception ex) {
				System.out.println("Exception " + ex.getClass().getCanonicalName() + " was thrown. Call to stateless bean was unsuccessful.");
				lost = true; lostTimes++;
			}
			if (Variables.verbose) {
				System.out.println(threadId + ": " + i);
			}
			
			while (lost) {
				if (Variables.verbose) {
					System.out.println("Retrying call to stateless bean.");
				}
				try {
					slb.getMessage();
				} catch (Exception ex) {
					System.out.println("Exception " + ex.getClass().getCanonicalName() + " was thrown. Call to stateless bean was unsuccessful.");
					continue;
				}
				lost = false;
				Thread.sleep(100);
			}
			Thread.sleep(Variables.sleep);
		}
		
		time = System.nanoTime()  - time;
		System.out.println(threadId + ": Number of stateless invocations: " + (i - 1) + ", elapsed time: " + ((double) time / 1000000000.0) + " seconds. Calls were lost " + lostTimes + " times.");
		
	}