@Override
	public void run() {
		while (isRunning) {
			synchronized(this) {
				while (requestQueue.isEmpty()) {
					try {
						this.wait();
					}
					catch (InterruptedException e) {
						e.printStackTrace();
					}
				}
			}

			while (!requestQueue.isEmpty()) {
				Request nextRequest;
				synchronized(this) {
					nextRequest = requestQueue.poll();
				}
				if (nextRequest.isRead()) {
					try {
						super.readBlock(nextRequest.getBuffer());
					} catch (IOException e) {
						e.printStackTrace();
					}
				} else if (nextRequest.isWrite()) {
					try {
						super.writeBlock(nextRequest.getBuffer());
					} catch (IOException e) {
						e.printStackTrace();
					}
				} else {
					System.err.println("UKNOWN OPERATION");
				}
				nextRequest.getBuffer().ioComplete();
			}
		}
		synchronized(doneSignal) {
			isComplete = true;
			doneSignal.notify();
		}
	}