Code example for SynchronousQueue

Methods: put

0
    } 
 
    // called in the main thread 
    public Object call(String methodName, Object... args) throws Throwable {
        MethodCall call = new MethodCall(methodName, args);
        methodCalls.put(call);
        return call.getResult();
    } 
 
    @Override 
    public void run() { 
        try { 
            while (true) { 
                MethodCall call = methodCalls.take();
                Object res;
                try { 
                    res = localCall(call.methodName, call.args);
                } catch (InvocationTargetException e) {
                    res = WrappedException.wrap(e.getCause());
                } catch (Exception e) {
                    // wrap the exception as its class may not be present on the