You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ch...@apache.org on 2018/09/05 14:48:36 UTC

[flink] 03/07: [hotfix][checkstyle] Remove suppression for runtime/network.buffer

This is an automated email from the ASF dual-hosted git repository.

chesnay pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git

commit 82c0db7e52586f501b905b67fa1297a9fb610e40
Author: zentol <ch...@apache.org>
AuthorDate: Wed Sep 5 16:31:36 2018 +0200

    [hotfix][checkstyle] Remove suppression for runtime/network.buffer
---
 .../apache/flink/runtime/io/network/buffer/BufferConsumer.java   | 5 +++--
 .../org/apache/flink/runtime/io/network/buffer/BufferPool.java   | 8 ++++----
 .../flink/runtime/io/network/buffer/BufferPoolFactory.java       | 2 +-
 .../apache/flink/runtime/io/network/buffer/BufferPoolOwner.java  | 3 +++
 .../apache/flink/runtime/io/network/buffer/BufferRecycler.java   | 3 +++
 .../flink/runtime/io/network/buffer/FreeingBufferRecycler.java   | 6 +++---
 .../runtime/io/network/buffer/LocalBufferPoolDestroyTest.java    | 3 +++
 .../flink/runtime/io/network/buffer/LocalBufferPoolTest.java     | 9 ++++++---
 tools/maven/suppressions-runtime.xml                             | 4 ++--
 9 files changed, 28 insertions(+), 15 deletions(-)

diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/BufferConsumer.java b/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/BufferConsumer.java
index 4bad92f..f368ff0 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/BufferConsumer.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/BufferConsumer.java
@@ -90,11 +90,12 @@ public class BufferConsumer implements Closeable {
 	}
 
 	/**
-	 * @return a retained copy of self with separate indexes - it allows two read from the same {@link MemorySegment}
-	 * twice.
+	 * Returns a retained copy with separate indexes. This allows to read from the same {@link MemorySegment} twice.
 	 *
 	 * <p>WARNING: newly returned {@link BufferConsumer} will have reader index copied from the original buffer. In
 	 * other words, data already consumed before copying will not be visible to the returned copies.
+	 *
+	 * @return a retained copy of self with separate indexes
 	 */
 	public BufferConsumer copy() {
 		return new BufferConsumer(buffer.retainBuffer(), writerPosition.positionMarker, currentReaderPosition);
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/BufferPool.java b/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/BufferPool.java
index a4928ed..2927fae 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/BufferPool.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/BufferPool.java
@@ -34,7 +34,7 @@ public interface BufferPool extends BufferProvider, BufferRecycler {
 	/**
 	 * Destroys this buffer pool.
 	 *
-	 * <p> If not all buffers are available, they are recycled lazily as soon as they are recycled.
+	 * <p>If not all buffers are available, they are recycled lazily as soon as they are recycled.
 	 */
 	void lazyDestroy();
 
@@ -50,7 +50,7 @@ public interface BufferPool extends BufferProvider, BufferRecycler {
 	int getNumberOfRequiredMemorySegments();
 
 	/**
-	 * Returns the maximum number of memory segments this buffer pool should use
+	 * Returns the maximum number of memory segments this buffer pool should use.
 	 *
 	 * @return maximum number of memory segments to use or <tt>-1</tt> if unlimited
 	 */
@@ -59,14 +59,14 @@ public interface BufferPool extends BufferProvider, BufferRecycler {
 	/**
 	 * Returns the current size of this buffer pool.
 	 *
-	 * <p> The size of the buffer pool can change dynamically at runtime.
+	 * <p>The size of the buffer pool can change dynamically at runtime.
 	 */
 	int getNumBuffers();
 
 	/**
 	 * Sets the current size of this buffer pool.
 	 *
-	 * <p> The size needs to be greater or equal to the guaranteed number of memory segments.
+	 * <p>The size needs to be greater or equal to the guaranteed number of memory segments.
 	 */
 	void setNumBuffers(int numBuffers) throws IOException;
 
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/BufferPoolFactory.java b/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/BufferPoolFactory.java
index ffed432..c90e302 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/BufferPoolFactory.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/BufferPoolFactory.java
@@ -29,7 +29,7 @@ public interface BufferPoolFactory {
 	 * Tries to create a buffer pool, which is guaranteed to provide at least the number of required
 	 * buffers.
 	 *
-	 * <p> The buffer pool is of dynamic size with at least <tt>numRequiredBuffers</tt> buffers.
+	 * <p>The buffer pool is of dynamic size with at least <tt>numRequiredBuffers</tt> buffers.
 	 *
 	 * @param numRequiredBuffers
 	 * 		minimum number of network buffers in this pool
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/BufferPoolOwner.java b/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/BufferPoolOwner.java
index 66a6995..acfe240 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/BufferPoolOwner.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/BufferPoolOwner.java
@@ -20,6 +20,9 @@ package org.apache.flink.runtime.io.network.buffer;
 
 import java.io.IOException;
 
+/**
+ * Interface for releasing memory buffers.
+ */
 public interface BufferPoolOwner {
 
 	void releaseMemory(int numBuffersToRecycle) throws IOException;
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/BufferRecycler.java b/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/BufferRecycler.java
index a6495d0..66b1fa2 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/BufferRecycler.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/BufferRecycler.java
@@ -20,6 +20,9 @@ package org.apache.flink.runtime.io.network.buffer;
 
 import org.apache.flink.core.memory.MemorySegment;
 
+/**
+ * Interface for recycling {@link MemorySegment}s.
+ */
 public interface BufferRecycler {
 
 	/**
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/FreeingBufferRecycler.java b/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/FreeingBufferRecycler.java
index fdce883..548c0cc 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/FreeingBufferRecycler.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/FreeingBufferRecycler.java
@@ -24,11 +24,11 @@ import org.apache.flink.core.memory.MemorySegment;
  * A simple buffer recycler that frees the memory segments.
  */
 public class FreeingBufferRecycler implements BufferRecycler {
-	
+
 	public static final BufferRecycler INSTANCE = new FreeingBufferRecycler();
-	
+
 	// ------------------------------------------------------------------------
-	
+
 	// Not instantiable
 	private FreeingBufferRecycler() {}
 
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/io/network/buffer/LocalBufferPoolDestroyTest.java b/flink-runtime/src/test/java/org/apache/flink/runtime/io/network/buffer/LocalBufferPoolDestroyTest.java
index fcbf9d5..5e8e42e 100644
--- a/flink-runtime/src/test/java/org/apache/flink/runtime/io/network/buffer/LocalBufferPoolDestroyTest.java
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/io/network/buffer/LocalBufferPoolDestroyTest.java
@@ -26,6 +26,9 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
+/**
+ * Tests for the destruction of a {@link LocalBufferPool}.
+ */
 public class LocalBufferPoolDestroyTest {
 
 	/**
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/io/network/buffer/LocalBufferPoolTest.java b/flink-runtime/src/test/java/org/apache/flink/runtime/io/network/buffer/LocalBufferPoolTest.java
index 7a6fe6a..537d167 100644
--- a/flink-runtime/src/test/java/org/apache/flink/runtime/io/network/buffer/LocalBufferPoolTest.java
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/io/network/buffer/LocalBufferPoolTest.java
@@ -50,17 +50,20 @@ import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.powermock.api.mockito.PowerMockito.spy;
 
+/**
+ * Tests for the {@link LocalBufferPool}.
+ */
 public class LocalBufferPoolTest extends TestLogger {
 
-	private final static int numBuffers = 1024;
+	private static final int numBuffers = 1024;
 
-	private final static int memorySegmentSize = 128;
+	private static final int memorySegmentSize = 128;
 
 	private NetworkBufferPool networkBufferPool;
 
 	private BufferPool localBufferPool;
 
-	private final static ExecutorService executor = Executors.newCachedThreadPool();
+	private static final ExecutorService executor = Executors.newCachedThreadPool();
 
 	@Before
 	public void setupLocalBufferPool() {
diff --git a/tools/maven/suppressions-runtime.xml b/tools/maven/suppressions-runtime.xml
index 16f48a1..7d6f60c 100644
--- a/tools/maven/suppressions-runtime.xml
+++ b/tools/maven/suppressions-runtime.xml
@@ -87,11 +87,11 @@ under the License.
 		files="(.*)test[/\\](.*)runtime[/\\]io[/\\]disk[/\\](.*)"
 		checks="AvoidStarImport|UnusedImports"/>
 	<suppress
-		files="(.*)runtime[/\\]io[/\\]network[/\\](buffer|netty|partition|serialization|util)[/\\](.*)"
+		files="(.*)runtime[/\\]io[/\\]network[/\\](netty|partition|serialization|util)[/\\](.*)"
 		checks="NewlineAtEndOfFile|RegexpSingleline|TodoComment|RedundantImport|ImportOrder|RedundantModifier|JavadocMethod|JavadocParagraph|JavadocType|JavadocStyle|PackageName|TypeNameCheck|ConstantNameCheck|StaticVariableNameCheck|MemberNameCheck|MethodNameCheck|ParameterName|LocalFinalVariableName|LocalVariableName|LeftCurly|UpperEll|FallThrough|reliefPattern|SimplifyBooleanExpression|EmptyStatement|ModifierOrder|EmptyLineSeparator|WhitespaceAround|WhitespaceAfter|NoWhitespaceAfter|NoWhite [...]
 	<!--Only additional checks for test sources. Those checks were present in the "pre-strict" checkstyle but were not applied to test sources. We do not want to suppress them for sources directory-->
 	<suppress
-		files="(.*)test[/\\](.*)runtime[/\\]io[/\\]network[/\\](buffer|netty|partition|serialization|util)[/\\](.*)"
+		files="(.*)test[/\\](.*)runtime[/\\]io[/\\]network[/\\](netty|partition|serialization|util)[/\\](.*)"
 		checks="AvoidStarImport|UnusedImports"/>
 	<!--Test class copied from the netty project-->
 	<suppress