@Override
	public void run() {
		if (System.getSecurityManager() == null) {
			System.setSecurityManager(new SecurityManager());
		}
		try {
			Registry registry = LocateRegistry
					.getRegistry(JobUtility.getPort());
			IJobProcessingService comp = (IJobProcessingService) registry
					.lookup(JobUtility.getDispatcherExecutionName());

			@SuppressWarnings("unchecked")
			IJob<Integer> job = (IJob<Integer>) UnicastRemoteObject
					.exportObject(new Job<Integer>(), 0);

			registry.rebind("Job" + clientId, job);

			for (int i = 0; i < requests; i++) {
				System.out.println("Client " + clientId + " request");
				comp.submit(new CallImplementation(), job);

				while (job != null && !job.isDone() && !job.isRefused()) {
					System.out.println("Client " + clientId + " waiting...");
					Thread.sleep(100);
				}
				
				if (job.isRefused())
					System.out.println("Client "+ clientId + " got refused.");
				else 
					System.out.println("Client " + clientId + " result: "
						+ job.getResult());
			}

			registry.unbind("Job" + clientId);
			try {
				UnicastRemoteObject.unexportObject(job, true);
			} catch (Exception e) {
				// welp
			}

//			try {
//				UnicastRemoteObject.unexportObject(registry, true);
//			} catch (Exception e) {
//				// welp
//			}
		} catch (Exception e) {
			e.printStackTrace();
		}

	}