Sends a {@link HelloReply} when a request has been completed with multiple {@link HelloRequest}s.
510085
@Override
    public StreamObserver<HelloRequest> lotsOfGreetings(StreamObserver<HelloReply> responseObserver) {
        return new StreamObserver<HelloRequest>() {
            final ArrayList<String> names = new ArrayList<>();

            @Override
            public void onNext(HelloRequest value) {
                names.add(value.getName());
            }

            @Override
            public void onError(Throwable t) {
                responseObserver.onError(t);
            }

            @Override
            public void onCompleted() {
                responseObserver.onNext(buildReply(toMessage(String.join(", ", names))));
                responseObserver.onCompleted();
            }
        };
    }
1049861
public void send(CEMI frame, BlockingMode mode) throws KNXConnectionClosedException
	{
		try {
			super.send(frame, NONBLOCKING);
			// we always succeed...
			setState(OK);
		}
		catch (final KNXTimeoutException e) {}
	}
430309
private void notifyListenersAfterResponse(ModbusResponse res) {
        synchronized (listeners) {
            for (AbstractSerialTransportListener listener : listeners) {
                listener.afterResponseRead(commPort, res);
            }
        }
    }
586134
public void requestCompleted (T result)
    {
        _result = result;
        ResultListener<T> list = _list;
        _list = null;

        list.requestCompleted(result);
    }
1289661
public synchronized void initialRequestDone() {
        initialRequestDone = true;
        if (previousAsyncContext != null) {
            previousAsyncContext.onAsyncStart(this);
            previousAsyncContext = null;
        }
        if (!processingAsyncTask) {
            processAsyncTask();
        }
        initiatingThread = null;
    }
219585
public FinishRequest toFinishRequest(boolean includeHeaders) {
        if (includeHeaders) {
            return new FinishRequest(body, copyHeaders(headers), statusCode);
        } else {
            String mime = null;
            if (body!=null) {
                mime = "text/plain";
                if (headers!=null && (headers.containsKey("Content-Type") || headers.containsKey("content-type"))) {
                    mime = headers.get("Content-Type");
                    if (mime==null) {
                        mime = headers.get("content-type");
                    }
                }
            }

            return new FinishRequest(body, mime, statusCode);
        }
    }
529952
@Override
    public SMTPClientFuture<FutureResult<Collection<SMTPResponse>>> send(SMTPPipeliningRequest request) {
        SMTPClientFutureImpl<FutureResult<Collection<SMTPResponse>>> future = new SMTPClientFutureImpl<FutureResult<Collection<SMTPResponse>>>(false);
        future.setSMTPClientSession(this);
        AggregationListener listener = new AggregationListener(future, request.getRequests().size());
        for(SMTPRequest req: request.getRequests()) {
            send(req).addListener(listener);
        }
        return future;
    }
1219337
public void onCompleted() {
    mSerializingExecutor.execute(() -> {
      Preconditions.checkState(mContext != null);
      try {
        completeRequest(mContext);
        replySuccess();
      } catch (Exception e) {
        LogUtils.warnWithException(LOG, "Exception occurred while completing write request {}.",
            mContext.getRequest(), e);
        Throwables.throwIfUnchecked(e);
        abort(new Error(AlluxioStatusException.fromCheckedException(e), true));
      }
    });
  }
322216
function(type, messageId, json) {
            var self = this;

            var listenerList = this.listeners[type] || [];

            var executedCount = 0;

            var complete = function() {
                executedCount += 1;

                if (executedCount >= listenerList.length) {
                    self.dispatcher.sendCallback(messageId);
                }
            };

            for (var index = 0; index < listenerList.length; index++) {
                var listener = listenerList[index];

                // If it's a "sync" listener, we'll call the complete() function
                // after it has finished. If it's async, we expect it to call complete().
                if (listener.length <= 1) {
                    listener(json);
                    complete();
                } else {
                    listener(json, complete);
                }
            }

        }
941025
@Override
  public ListenableFuture<CloseableHttpResponse> sendRequest(final HttpUriRequest request) throws IOException {
    return singleThreadPool.submit(new Callable<CloseableHttpResponse>() {
      @Override
      public CloseableHttpResponse call() throws Exception {
        return client.execute(request);
      }
    });
  }
829704
public void greet(String name) {
    logger.info("Will try to greet " + name + " ...");
    HelloRequest request = HelloRequest.newBuilder().setName(name).build();
    HelloReply response;

    SpanBuilder spanBuilder =
        tracer.spanBuilder("client").setRecordEvents(true).setSampler(Samplers.alwaysSample());
    try (Scope scope = spanBuilder.startScopedSpan()) {
      tracer.getCurrentSpan().addAnnotation("Saying Hello to Server.");
      response = blockingStub.sayHello(request);
      tracer.getCurrentSpan().addAnnotation("Received response from Server.");
    } catch (StatusRuntimeException e) {
      tracer
          .getCurrentSpan()
          .setStatus(
              CanonicalCode.valueOf(e.getStatus().getCode().name())
                  .toStatus()
                  .withDescription(e.getMessage()));
      logger.log(Level.WARNING, "RPC failed: {0}", e.getStatus());
      return;
    }
    logger.info("Greeting: " + response.getMessage());
  }
1222804
@Override
    public void sendResponseHeaders() throws IOException, MessageSentException {

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "sendResponseHeaders(sync)");
        }
        if (!headersParsed()) {
            // request message must have the headers parsed prior to sending
            // any data out (this is a completely invalid state in the channel
            // above)
            IOException ioe = new IOException("Request not read yet");
            FFDCFilter.processException(ioe,
                                        CLASS_NAME + ".sendResponseHeaders", "594");
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Attempt to send response without a request msg");
            }
            throw ioe;
        }

        if (headersSent()) {
            throw new MessageSentException("Message already sent");
        }

        sendHeaders(getResponseImpl());
        if (getResponseImpl().isTemporaryStatusCode()) {
            // allow multiple temporary responses to be sent out
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Temp response sent, resetting send flags.");
            }
            resetWrite();
        }
    }
363345
@Route(method = HttpMethod.POST, uri = "/json/hello")
    public Result hello() {
        JsonNode json = context().body(JsonNode.class);
        if (json == null) {
            return badRequest("Expecting Json data");
        } else {
            String name = json.findPath("name").textValue();
            if (name == null) {
                return badRequest("Missing parameter [name]");
            } else {
                return ok("Hello " + name);
            }
        }
    }
525177
private void sendReply(Response<ByteString> response) {
    if (!replied.compareAndSet(false, true)) {
      LOGGER.warn("Already replied to ongoing request {} - spurious response {}", request, response);
    } else {
      final HttpServletResponse httpResponse = (HttpServletResponse) asyncContext.getResponse();

      final StatusType status = response.status();
      httpResponse.setStatus(status.code(), status.reasonPhrase());

      response.headerEntries().forEach(entry ->
          httpResponse.addHeader(entry.getKey(), entry.getValue()));

      response.payload().ifPresent(payload -> {
        try {
          payload.write(httpResponse.getOutputStream());
        } catch (IOException e) {
          LOGGER.warn("Failed to write response", e);
        }
      });

      asyncContext.complete();

      logger.accept(this, Optional.of(response));
    }
  }
1211398
private void sendNextPayload() {
		singleThreadExecutor.execute(new Runnable() {
			@Override
			public void run() {
				try {
					sendNextPayloadSync();
				} catch (Exception e) {
					ApptentiveLog.e(e, "Exception while trying to send next payload");
					logException(e);
				}
			}
		});
	}
1110289
@Override
    public void hello(Hello hello) {
        log.info("Received hello from connection: {}", connection);
        connection.send(new Hello(WireCommands.WIRE_VERSION, WireCommands.OLDEST_COMPATIBLE_VERSION));
        if (hello.getLowVersion() > WireCommands.WIRE_VERSION || hello.getHighVersion() < WireCommands.OLDEST_COMPATIBLE_VERSION) {
            log.warn("Incompatible wire protocol versions {} from connection {}", hello, connection);
            connection.close();
        }
    }
235091
@Override
  public void streamReply(WebSocket session,
                          HeadersAmp headers,
                          String to,
                          long qid,
                          int sequence,
                          List<Object> values,
                          Throwable exn,
                          boolean isComplete)
    throws IOException
  {
    /*
    if (values != null && values.size() > 0) {
      try (Writer out = session.getBasicRemote().getSendWriter()) {
        init(out);
        streamResult(headers, to, qid, values);
      }
    }
    
    if (exn != null) {
      try (Writer out = session.getBasicRemote().getSendWriter()) {
        init(out);
        streamError(headers, to, qid, exn);
      }
    }
    else if (isComplete) {
      try (Writer out = session.getBasicRemote().getSendWriter()) {
        init(out);
        streamComplete(headers, to, qid);
      }
    }
    */
  }