@Override public void run() { long startTime = System.currentTimeMillis(); long startMeasureTime = System.currentTimeMillis(); long currtime = startMeasureTime; int counter = 0; while (!submittedTasks.isEmpty()) { currtime = System.currentTimeMillis(); if (currtime - startMeasureTime >= throughputpolltime) { startMeasureTime = currtime; PrintManager.PrintProdMessage("Recording throughput " + System.nanoTime() + " " + counter); mapThroughPutStatus.putIfAbsent( clientName + "," + System.nanoTime(), String.valueOf(counter)); counter = 0; } Task task = TaskQueueFactory.getQueue().retrieveTask(RESPONSEQ, url, clientName); if (task != null) { if (task.isMultiTask()) { for (Task tasks : task.getTasks()) { PrintManager.PrintMessage("Task[" + tasks.getTaskId() + "]completed"); submittedTasks.remove(tasks.getTaskId()); counter++; } } else { PrintManager.PrintMessage("Task[" + task.getTaskId() + "]completed"); submittedTasks.remove(task.getTaskId()); counter++; } } // Advertise tasks again after some time if (System.currentTimeMillis() - startTime > pollTime) { PrintManager.PrintProdMessage( "PANIC !!! Queue Resubmistions by Client at " + System.nanoTime()); startTime = System.currentTimeMillis(); DistributedQueue queue = QueueFactory.getQueue(); queue.pushToQueue(qu); } } if (monitoringEnabled) { // Shutdown monitor objClientMonior.setClientShutoff(true); } String time = String.valueOf(System.nanoTime()); String[] valFin = {clientName, String.valueOf(System.nanoTime()), FINISHED}; mapClientStatus.putIfAbsent(this.clientName + "," + FINISHED, time); if (monitoringEnabled) { cassandraClient.insertClientStatus(valFin); try { Thread.sleep(6000); } catch (InterruptedException e) { PrintManager.PrintException(e); } } PrintManager.PrintProdMessage("Shutting down Client " + this.clientName + " at " + time); // Shutdown hazel hazelClinetObj.shutdown(); if (monitoringEnabled) { cassandraClient.close(); } PrintManager.PrintProdMessage("Lock status" + this.stageLock.hasQueuedThreads()); this.stageLock.release(); }