AsyncChannelDispatcher.completeConnection
Code IndexAdd Codota to your IDE (free)

Best code snippets using org.apache.nifi.processor.util.listen.dispatcher.AsyncChannelDispatcher.completeConnection(Showing top 13 results out of 315)

origin: apache/nifi

public void handle(final RELPFrame frame, final ChannelResponder<SocketChannel> responder, final String sender)
    throws IOException, InterruptedException {
  // respond to open and close commands immediately, create and queue an event for everything else
  if (CMD_OPEN.equals(frame.getCommand())) {
    Map<String,String> offers = RELPResponse.parseOffers(frame.getData(), charset);
    ChannelResponse response = new RELPChannelResponse(encoder, RELPResponse.open(frame.getTxnr(), offers));
    responder.addResponse(response);
    responder.respond();
  } else if (CMD_CLOSE.equals(frame.getCommand())) {
    ChannelResponse response = new RELPChannelResponse(encoder, RELPResponse.ok(frame.getTxnr()));
    responder.addResponse(response);
    responder.respond();
    dispatcher.completeConnection(key);
  } else {
    final Map<String, String> metadata = EventFactoryUtil.createMapWithSender(sender.toString());
    metadata.put(RELPMetadata.TXNR_KEY, String.valueOf(frame.getTxnr()));
    metadata.put(RELPMetadata.COMMAND_KEY, frame.getCommand());
    final E event = eventFactory.create(frame.getData(), metadata, responder);
    events.offer(event);
  }
}
origin: apache/nifi

@Override
protected void processBuffer(final SSLSocketChannel sslSocketChannel, final SocketChannel socketChannel,
               final int bytesRead, final byte[] buffer) throws InterruptedException, IOException {
  final InetAddress sender = socketChannel.socket().getInetAddress();
  try {
    // go through the buffer parsing the RELP command
    for (int i = 0; i < bytesRead; i++) {
      byte currByte = buffer[i];
      // if we found the end of a frame, handle the frame and mark the buffer
      if (decoder.process(currByte)) {
        final RELPFrame frame = decoder.getFrame();
        logger.debug("Received RELP frame with transaction {} and command {}",
            new Object[] {frame.getTxnr(), frame.getCommand()});
        final SSLSocketChannelResponder responder = new SSLSocketChannelResponder(socketChannel, sslSocketChannel);
        frameHandler.handle(frame, responder, sender.toString());
      }
    }
    logger.debug("Done processing buffer");
  } catch (final RELPFrameException rfe) {
    logger.error("Error reading RELP frames due to {}", new Object[] {rfe.getMessage()} , rfe);
    // if an invalid frame or bad data was sent then the decoder will be left in a
    // corrupted state, so lets close the connection and cause the client to re-establish
    dispatcher.completeConnection(key);
  }
}
origin: apache/nifi

@Override
protected void processBuffer(final SocketChannel socketChannel, final ByteBuffer socketBuffer)
    throws InterruptedException, IOException {
  // get total bytes in buffer
  final int total = socketBuffer.remaining();
  final InetAddress sender = socketChannel.socket().getInetAddress();
  try {
    // go through the buffer parsing the RELP command
    for (int i = 0; i < total; i++) {
      byte currByte = socketBuffer.get();
      // if we found the end of a frame, handle the frame and mark the buffer
      if (decoder.process(currByte)) {
        final RELPFrame frame = decoder.getFrame();
        logger.debug("Received RELP frame with transaction {} and command {}",
            new Object[] {frame.getTxnr(), frame.getCommand()});
        final SocketChannelResponder responder = new SocketChannelResponder(socketChannel);
        frameHandler.handle(frame, responder, sender.toString());
        socketBuffer.mark();
      }
    }
    logger.debug("Done processing buffer");
  } catch (final RELPFrameException rfe) {
    logger.error("Error reading RELP frames due to {}", new Object[] {rfe.getMessage()}, rfe);
    // if an invalid frame or bad data was sent then the decoder will be left in a
    // corrupted state, so lets close the connection and cause the client to re-establish
    dispatcher.completeConnection(key);
  }
}
origin: apache/nifi

dispatcher.completeConnection(key);
origin: apache/nifi

if(eof == true) {
  IOUtils.closeQuietly(sslSocketChannel);
  dispatcher.completeConnection(key);
} else {
  dispatcher.addBackForSelection(key);
origin: apache/nifi

dispatcher.completeConnection(key);
origin: org.apache.nifi/nifi-processor-utils

if(eof == true) {
  IOUtils.closeQuietly(socketChannel);
  dispatcher.completeConnection(key);
} else {
  dispatcher.addBackForSelection(key);
origin: apache/nifi

dispatcher.completeConnection(key);
origin: apache/nifi

dispatcher.completeConnection(key);
origin: apache/nifi

if(eof == true) {
  IOUtils.closeQuietly(socketChannel);
  dispatcher.completeConnection(key);
} else {
  dispatcher.addBackForSelection(key);
origin: org.apache.nifi/nifi-processor-utils

if(eof == true) {
  IOUtils.closeQuietly(sslSocketChannel);
  dispatcher.completeConnection(key);
} else {
  dispatcher.addBackForSelection(key);
origin: org.apache.nifi/nifi-processor-utils

if(eof == true) {
  IOUtils.closeQuietly(socketChannel);
  dispatcher.completeConnection(key);
} else {
  dispatcher.addBackForSelection(key);
origin: org.apache.nifi/nifi-processor-utils

if(eof == true) {
  IOUtils.closeQuietly(sslSocketChannel);
  dispatcher.completeConnection(key);
} else {
  dispatcher.addBackForSelection(key);
org.apache.nifi.processor.util.listen.dispatcherAsyncChannelDispatchercompleteConnection

Javadoc

Informs the dispatcher that the connection for the given key is complete.

Popular methods of AsyncChannelDispatcher

  • addBackForSelection
    Informs the dispatcher that the connection for the given key can be added back for selection.

Popular classes and methods

  • findViewById (Activity)
  • getOriginalFilename (MultipartFile)
  • getContentResolver (Context)
  • RandomAccessFile (java.io)
    Saves binary data to the local storage; currently using hex encoding. The string is prefixed with "h
  • URI (java.net)
    Represents a Uniform Resource Identifier (URI) reference. Aside from some minor deviations noted bel
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on *
  • JComboBox (javax.swing)
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t

For IntelliJ IDEA,
Android Studio or Eclipse

  • Codota IntelliJ IDEA pluginCodota Android Studio pluginCode IndexSign in
  • EnterpriseFAQAboutContact Us
  • Terms of usePrivacy policyCodeboxFind Usages
Add Codota to your IDE (free)