Code example for ExecutorService

Methods: execute

0
	 *  
	 * @param url - String url to connect to 
	 * @param handler - handler to recieve the response 
	 */ 
	public static void getJSONAsync(final String url, final Handler handler) {
		pool.execute(new Runnable() {
 
			@Override 
			public void run() { 
				try { 
					JSONObject resp = getJSON(url);
					if(handler != null) {
						Message.obtain(handler, OK, resp).sendToTarget();
					} else System.out.println(resp.toString());
				} catch (Exception t) {
					if(handler != null) Message.obtain(handler, ERR, t).sendToTarget();
					else t.printStackTrace();
				} 
			} 
		}); 
	}