@Override public R call(T1 t1, T2 t2) { action.call(t1, t2); return result; } };
@Override public void failedAcceptingSession(Integer sessionId, Throwable t) throws Throwable { if (failedAcceptance != null) { failedAcceptance.call(sessionId, t); } }
@Override public R call(T1 t1, T2 t2) { action.call(t1, t2); return result; } };
@Override public R call(T1 t1, T2 t2) { action.call(t1, t2); return result; } };
@Override public void failedAcceptingSession(Integer sessionId, Throwable t) throws Throwable { if (failedAcceptance != null) { failedAcceptance.call(sessionId, t); } }
private <T> void _write(T byteBuffer, Action2<T, Callback> writeAction, Action0 succeeded, Action1<Throwable> failed) { Callback callback = new Callback() { @Override public void succeeded() { if (succeeded != null) { succeeded.call(); } } @Override public void failed(Throwable x) { if (failed != null) { failed.call(x); } } }; writeAction.call(byteBuffer, callback); }
private <T> void _write(T byteBuffer, Action2<T, Callback> writeAction, Action0 succeeded, Action1<Throwable> failed) { Callback callback = new Callback() { @Override public void succeeded() { if (succeeded != null) { succeeded.call(); } } @Override public void failed(Throwable x) { if (failed != null) { failed.call(x); } } }; writeAction.call(byteBuffer, callback); }
@SuppressWarnings("unchecked") @Override public Void call(Object... args) { if (args.length != 2) { throw new RuntimeException("Action3 expecting 2 arguments."); } f.call((T0) args[0], (T1) args[1]); return null; }
@SuppressWarnings("unchecked") @Override public Void call(Object... args) { if (args.length != 2) { throw new RuntimeException("Action3 expecting 2 arguments."); } f.call((T0) args[0], (T1) args[1]); return null; }
@SuppressWarnings("unchecked") @Override public Void call(Object... args) { if (args.length != 2) { throw new RuntimeException("Action3 expecting 2 arguments."); } f.call((T0) args[0], (T1) args[1]); return null; }
public void onError(Throwable t, WebSocketConnection connection) { Optional.ofNullable(onError).ifPresent(e -> e.call(t, connection)); } }
public void onError(Throwable t, WebSocketConnection connection) { Optional.ofNullable(onError).ifPresent(e -> e.call(t, connection)); } }
public void notifyException(Throwable t) { log.info("The handler called {} exception listener. Session: {}", this.getClass(), connection.getSessionId()); exceptionListeners.forEach(e -> e.call(connection, t)); } }
public void notifyException(Throwable t) { log.info("The handler called {} exception listener. Session: {}", this.getClass(), connection.getSessionId()); exceptionListeners.forEach(e -> e.call(connection, t)); } }
public void onFrame(Frame frame, WebSocketConnection connection) { switch (frame.getType()) { case TEXT: Optional.ofNullable(onText).ifPresent(t -> t.call(((DataFrame) frame).getPayloadAsUTF8(), connection)); break; case CONTINUATION: case BINARY: Optional.ofNullable(onData).ifPresent(d -> d.call(frame.getPayload(), connection)); break; } }
public void onFrame(Frame frame, WebSocketConnection connection) { switch (frame.getType()) { case TEXT: Optional.ofNullable(onText).ifPresent(t -> t.call(((DataFrame) frame).getPayloadAsUTF8(), connection)); break; case CONTINUATION: case BINARY: Optional.ofNullable(onData).ifPresent(d -> d.call(frame.getPayload(), connection)); break; } }
private <T> CompletableFuture<Boolean> _sendData(T data, Action2<BinaryFrame, T> setData) { BinaryFrame binaryFrame = new BinaryFrame(); setData.call(binaryFrame, data); CompletableFuture<Boolean> future = new CompletableFuture<>(); outgoingFrame(binaryFrame, new Callback() { @Override public void succeeded() { future.complete(true); } @Override public void failed(Throwable x) { future.completeExceptionally(x); } }); return future; }
private <T> CompletableFuture<Boolean> _sendData(T data, Action2<BinaryFrame, T> setData) { BinaryFrame binaryFrame = new BinaryFrame(); setData.call(binaryFrame, data); CompletableFuture<Boolean> future = new CompletableFuture<>(); outgoingFrame(binaryFrame, new Callback() { @Override public void succeeded() { future.complete(true); } @Override public void failed(Throwable x) { future.completeExceptionally(x); } }); return future; }
private <T> void encrypt(OutputEntry<T> entry, Action2<T, Callback> encrypt) { if (isEncrypted()) { encrypt.call(entry.getData(), entry.getCallback()); } }
private <T> void encrypt(OutputEntry<T> entry, Action2<T, Callback> encrypt) { if (isEncrypted()) { encrypt.call(entry.getData(), entry.getCallback()); } }