@Override public void call(List<MethodCall<Object>> methodCalls) { if (methodCalls.size() > 0) { String returnAddress = methodCalls.get(0).returnAddress(); @SuppressWarnings("unchecked") List<Message<Object>> methods = (List<Message<Object>>) (Object) methodCalls; sender.send(returnAddress, encoder.encodeAsString(methods)); } }
@Override public void flush() { if (methodCalls.size() > 0) { Message<Object> method; List<Message<Object>> methods; methods = new ArrayList<>(methodCalls.size()); do { method = methodCalls.poll(); methods.add(method); } while (method != null); if (methods.size() > 0) { sender.send( ((MethodCall<Object>) methods.get(0)).returnAddress(), encoder.encodeAsString(methods)); } } }