import java.util.concurrent.*;
import java.net.*;
import java.io.*;
import org.json.simple.*;
import org.json.simple.parser.*;

public class RequestHandler implements Runnable {
	
    static ConcurrentHashMap<String, String> d = new ConcurrentHashMap<String, String>(16, 0.9f, 2);
    static ArrayBlockingQueue<RequestHandler> all = new ArrayBlockingQueue<RequestHandler>(32);
    final JSONParser p;
    final Socket s;
    
    public RequestHandler(Socket s) throws InterruptedException {
		try { all.put(this); } catch (Exception e) {}
		this.s = s;
		p = new JSONParser();
    }
	
    public void run() {
		try {
			String inJSON = RequestHandler.readString(new InputStreamReader(s.getInputStream(), "UTF8"), 64);
			System.out.println(inJSON);
			
			JSONObject j = (JSONObject) p.parse(inJSON);
			String party = (String) j.get("party");
			String storedJSON = d.put(party, j.toString());			
			if(storedJSON == null) {
				while(d.get(party).equals(j.toString()))
					synchronized(d) { d.wait(); }
				storedJSON = d.get(party);
				d.remove(party);
			} else {
				synchronized (d) { d.notifyAll(); }
			}
			s.getOutputStream().write(storedJSON.getBytes("UTF8"));
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
				s.close();
			} catch (Exception e) {}
		}      
    }
	
    public void closeSocket() {
		try {
			System.out.println("Closing socket...");
			s.close();
		} catch (Exception e) {
			e.printStackTrace();
		} 
    }

	public static String readString(Reader ir, int buffersize) throws IOException {
	StringBuilder inJSONBuilder = new StringBuilder();
	char[] buffer = new char[buffersize];
	do {
		int i = ir.read(buffer, 0, buffersize);
		inJSONBuilder.append(buffer, 0, i);
	} while (ir.ready());
	return inJSONBuilder.toString();
}
}

@@ -888,19 +888,16 @@
 ring());
-%09%09%09
 %0A%09%09%09if(s
@@ -1540,16 +1540,17 @@
 ption %7B%0A
+%09
 %09StringB
@@ -1593,16 +1593,17 @@
 lder();%0A
+%09
 %09char%5B%5D 
@@ -1637,14 +1637,16 @@
 e%5D;%0A
+%09
 %09do %7B%0A
+%09
 %09%09in
@@ -1685,16 +1685,17 @@
 ize);%0A%09%09
+%09
 inJSONBu
@@ -1722,16 +1722,17 @@
  0, i);%0A
+%09
 %09%7D while
@@ -1746,16 +1746,17 @@
 ady());%0A
+%09
 %09return 
@@ -1781,12 +1781,13 @@
 ring();%0A
+%09
 %7D%0A%7D%0A

Fix indentation