You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by al...@apache.org on 2017/01/26 21:07:05 UTC

nifi git commit: NIFI-2615 Addressing documentation issues that caused checkstyle failures and the build to fail

Repository: nifi
Updated Branches:
  refs/heads/master c15111d98 -> 250c4a894


NIFI-2615 Addressing documentation issues that caused checkstyle failures and the build to fail

This closes #1447.

Signed-off-by: Andy LoPresto <al...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/250c4a89
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/250c4a89
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/250c4a89

Branch: refs/heads/master
Commit: 250c4a89416b0150e5a90488e72464e431efb540
Parents: c15111d
Author: Andrew Psaltis <ps...@gmail.com>
Authored: Thu Jan 26 00:48:35 2017 -0500
Committer: Andy LoPresto <al...@apache.org>
Committed: Thu Jan 26 13:05:33 2017 -0800

----------------------------------------------------------------------
 .../gettcp/AbstractSocketHandler.java           | 22 ++++++++++++++++++--
 .../apache/nifi/processors/gettcp/GetTCP.java   |  5 +++--
 .../nifi/processors/gettcp/ReceivingClient.java |  6 ++++--
 3 files changed, 27 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/250c4a89/nifi-nar-bundles/nifi-tcp-bundle/nifi-tcp-processors/src/main/java/org/apache/nifi/processors/gettcp/AbstractSocketHandler.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-tcp-bundle/nifi-tcp-processors/src/main/java/org/apache/nifi/processors/gettcp/AbstractSocketHandler.java b/nifi-nar-bundles/nifi-tcp-bundle/nifi-tcp-processors/src/main/java/org/apache/nifi/processors/gettcp/AbstractSocketHandler.java
index 5477053..547ee79 100644
--- a/nifi-nar-bundles/nifi-tcp-bundle/nifi-tcp-processors/src/main/java/org/apache/nifi/processors/gettcp/AbstractSocketHandler.java
+++ b/nifi-nar-bundles/nifi-tcp-bundle/nifi-tcp-processors/src/main/java/org/apache/nifi/processors/gettcp/AbstractSocketHandler.java
@@ -56,6 +56,8 @@ abstract class AbstractSocketHandler {
     protected final byte endOfMessageByte;
 
     /**
+     * This constructor configures the address to bind to, the size of the buffer to use for reading, and
+     * the byte pattern to use for demarcating the end of a message.
      *
      * @param address the socket address
      * @param readingBufferSize the buffer size
@@ -70,7 +72,10 @@ abstract class AbstractSocketHandler {
     }
 
     /**
+     * Once the handler is constructed this should be called to start the handler. Although
+     * this method is safe to be called by multiple threads, it should only be called once.
      *
+     * @throws IllegalStateException if it fails to start listening on the port that is configured
      *
      */
     public void start() {
@@ -96,7 +101,9 @@ abstract class AbstractSocketHandler {
     }
 
     /**
-     *
+     * This should be called to stop the handler from listening on the socket. Although it is recommended
+     * that this is called once, by a single thread, this method does protect itself from being called by more
+     * than one thread and more than one time.
      *
      */
     public void stop() {
@@ -135,13 +142,15 @@ abstract class AbstractSocketHandler {
     }
 
     /**
+     * This must be overridden by an implementing class and should establish the socket connection.
      *
      * @throws Exception if an exception occurs
      */
     abstract InetSocketAddress connect() throws Exception;
 
     /**
-     * Will process the data received from the channel
+     * Will process the data received from the channel.
+     *
      * @param selectionKey key for the channel the data came from
      * @param buffer buffer of received data
      * @throws IOException if there is a problem processing the data
@@ -149,6 +158,8 @@ abstract class AbstractSocketHandler {
     abstract void processData(SelectionKey selectionKey, ByteBuffer buffer) throws IOException;
 
     /**
+     * This does not perform any work at this time as all current implementations of this class
+     * provide the client side of the connection and thus do not accept connections.
      *
      * @param selectionKey the selection key
      * @throws IOException if there is a problem
@@ -193,14 +204,21 @@ abstract class AbstractSocketHandler {
         }
 
         /**
+         * Accept the selectable channel
          *
+         * @throws IOException in the event that something goes wrong accepting it
          */
         private void accept(SelectionKey selectionKey) throws IOException {
             AbstractSocketHandler.this.doAccept(selectionKey);
         }
 
         /**
+         * This will connect the channel; if it is in a pending state then this will finish
+         * establishing the connection. Finally the socket handler is registered with this
+         * channel.
          *
+         * @throws IOException if anything goes wrong during the connection establishment
+         * or registering of the handler
          */
         private void connect(SelectionKey selectionKey) throws IOException {
             SocketChannel clientChannel = (SocketChannel) selectionKey.channel();

http://git-wip-us.apache.org/repos/asf/nifi/blob/250c4a89/nifi-nar-bundles/nifi-tcp-bundle/nifi-tcp-processors/src/main/java/org/apache/nifi/processors/gettcp/GetTCP.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-tcp-bundle/nifi-tcp-processors/src/main/java/org/apache/nifi/processors/gettcp/GetTCP.java b/nifi-nar-bundles/nifi-tcp-bundle/nifi-tcp-processors/src/main/java/org/apache/nifi/processors/gettcp/GetTCP.java
index 172a4f9..eecb662 100644
--- a/nifi-nar-bundles/nifi-tcp-bundle/nifi-tcp-processors/src/main/java/org/apache/nifi/processors/gettcp/GetTCP.java
+++ b/nifi-nar-bundles/nifi-tcp-bundle/nifi-tcp-processors/src/main/java/org/apache/nifi/processors/gettcp/GetTCP.java
@@ -28,7 +28,6 @@ import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ScheduledThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
-
 import org.apache.nifi.annotation.behavior.InputRequirement;
 import org.apache.nifi.annotation.behavior.SideEffectFree;
 import org.apache.nifi.annotation.behavior.TriggerSerially;
@@ -269,7 +268,9 @@ public class GetTCP extends AbstractSessionFactoryProcessor {
     }
 
     /**
-     *
+     * This handles taking the message that has been received off the wire and writing it to the
+     * content of a flowfile. If only a partial message is received then the flowfile is sent to
+     * the Partial relationship. If a full message is received then it is sent to the Success relationship.
      */
     private class NiFiDelegatingMessageHandler implements MessageHandler {
         private final ProcessSessionFactory sessionFactory;

http://git-wip-us.apache.org/repos/asf/nifi/blob/250c4a89/nifi-nar-bundles/nifi-tcp-bundle/nifi-tcp-processors/src/main/java/org/apache/nifi/processors/gettcp/ReceivingClient.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-tcp-bundle/nifi-tcp-processors/src/main/java/org/apache/nifi/processors/gettcp/ReceivingClient.java b/nifi-nar-bundles/nifi-tcp-bundle/nifi-tcp-processors/src/main/java/org/apache/nifi/processors/gettcp/ReceivingClient.java
index 2fb7c33..1927b99 100644
--- a/nifi-nar-bundles/nifi-tcp-bundle/nifi-tcp-processors/src/main/java/org/apache/nifi/processors/gettcp/ReceivingClient.java
+++ b/nifi-nar-bundles/nifi-tcp-bundle/nifi-tcp-processors/src/main/java/org/apache/nifi/processors/gettcp/ReceivingClient.java
@@ -59,7 +59,9 @@ class ReceivingClient extends AbstractSocketHandler {
     }
 
     /**
-     *
+     * Connects to the endpoint specified and if that fails, will attempt to connect to the
+     * secondary endpoint up to the number of reconnection attempts (inclusive) using the
+     * configured delay between attempts.
      */
     @Override
     InetSocketAddress connect() throws Exception {
@@ -119,7 +121,7 @@ class ReceivingClient extends AbstractSocketHandler {
     }
 
     /**
-     *
+     * Process the message that has arrived off the wire.
      */
     @Override
     void processData(SelectionKey selectionKey, ByteBuffer messageBuffer) throws IOException {