[geode-examples] branch rhoughton-pivot-patch-1 created (now e32c0a8)
This is an automated email from the ASF dual-hosted git repository. rhoughton pushed a change to branch rhoughton-pivot-patch-1 in repository https://gitbox.apache.org/repos/asf/geode-examples.git. at e32c0a8 Update README.md No new revisions were added by this update.
[geode-examples] branch test-code-ownership updated: modify .asf.yml for test branch
This is an automated email from the ASF dual-hosted git repository. rhoughton pushed a commit to branch test-code-ownership in repository https://gitbox.apache.org/repos/asf/geode-examples.git The following commit(s) were added to refs/heads/test-code-ownership by this push: new b3a3b48 modify .asf.yml for test branch b3a3b48 is described below commit b3a3b48c51c25dc026b9f3d2207b297d7ce2d974 Author: Owen Nichols AuthorDate: Fri Oct 30 16:18:54 2020 -0700 modify .asf.yml for test branch --- .asf.yaml | 14 ++ 1 file changed, 14 insertions(+) diff --git a/.asf.yaml b/.asf.yaml index 003d459..04a28f0 100644 --- a/.asf.yaml +++ b/.asf.yaml @@ -12,3 +12,17 @@ notifications: issues: iss...@geode.apache.org pullrequests: notificati...@geode.apache.org jira_options: link label comment + + +github: + protected_branches: +test-code-ownership: + required_status_checks: +strict: true +contexts: +- continuous-integration/travis-ci/pr +- continuous-integration/travis-ci/push + required_pull_request_reviews: +dismiss_stale_reviews: true +require_code_owner_reviews: true +required_approving_review_count: 1
[geode-examples] branch test-code-ownership updated (403efa3 -> a95053f)
This is an automated email from the ASF dual-hosted git repository. rhoughton pushed a change to branch test-code-ownership in repository https://gitbox.apache.org/repos/asf/geode-examples.git. omit 403efa3 Testing a CODEOWNERS file new a95053f Testing a CODEOWNERS file This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (403efa3) \ N -- N -- N refs/heads/test-code-ownership (a95053f) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
[geode-examples] branch rhoughton-pivot-patch-1 created (now 953cc26)
This is an automated email from the ASF dual-hosted git repository. rhoughton pushed a change to branch rhoughton-pivot-patch-1 in repository https://gitbox.apache.org/repos/asf/geode-examples.git. at 953cc26 Update README.md This branch includes the following new commits: new 953cc26 Update README.md The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
[geode-examples] 01/01: Testing a CODEOWNERS file
This is an automated email from the ASF dual-hosted git repository. rhoughton pushed a commit to branch test-code-ownership in repository https://gitbox.apache.org/repos/asf/geode-examples.git commit a95053f4fa3f173f43727a53a831fe502635ef7d Author: Robert Houghton AuthorDate: Fri Oct 30 15:53:14 2020 -0700 Testing a CODEOWNERS file Co-authored-by: Robert Houghton Co-authored-by: Owen Nichols --- CODEOWNERS | 8 1 file changed, 8 insertions(+) diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 000..f6b15ff --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1,8 @@ +* @upthewaterspout + +/wan @rhoughton-pivot @upthewaterspout @onichols-pivotal +*gradle* @rhoughton-pivot + +/README.md @onichols-pivotal + +# *.jar @apache/geode-committers
[geode-examples] 01/01: Update README.md
This is an automated email from the ASF dual-hosted git repository. rhoughton pushed a commit to branch rhoughton-pivot-patch-1 in repository https://gitbox.apache.org/repos/asf/geode-examples.git commit 953cc26ecc2b074f42130c15aaac776b5576b4c7 Author: Robert Houghton AuthorDate: Fri Oct 30 16:07:20 2020 -0700 Update README.md --- wan/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/wan/README.md b/wan/README.md index e092ecb..322dc99 100644 --- a/wan/README.md +++ b/wan/README.md @@ -123,3 +123,4 @@ as well as printed to the console. $ ../gradlew cleanServer +tag lots of folks
[geode-examples] branch onichols-pivotal-patch-1 created (now afb70bb)
This is an automated email from the ASF dual-hosted git repository. onichols pushed a change to branch onichols-pivotal-patch-1 in repository https://gitbox.apache.org/repos/asf/geode-examples.git. at afb70bb Update build.gradle This branch includes the following new commits: new afb70bb Update build.gradle The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
[geode-examples] 01/01: Update build.gradle
This is an automated email from the ASF dual-hosted git repository. onichols pushed a commit to branch onichols-pivotal-patch-1 in repository https://gitbox.apache.org/repos/asf/geode-examples.git commit afb70bb3bab6cdfb23fd68ab6d93a7fd84eab154 Author: Owen Nichols <34043438+onichols-pivo...@users.noreply.github.com> AuthorDate: Fri Oct 30 16:02:45 2020 -0700 Update build.gradle this is bad, I hope someone catches it --- lucene/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lucene/build.gradle b/lucene/build.gradle index d373d3a..7f9caf5 100644 --- a/lucene/build.gradle +++ b/lucene/build.gradle @@ -15,5 +15,5 @@ * limitations under the License. */ dependencies { -compile "org.apache.geode:geode-lucene:$geodeVersion" -} \ No newline at end of file +compile "org.apache.geode:geode-lucene:1.13.0" +}
[geode-examples] branch rhoughton-pivot-patch-2 created (now 3e22144)
This is an automated email from the ASF dual-hosted git repository. rhoughton pushed a change to branch rhoughton-pivot-patch-2 in repository https://gitbox.apache.org/repos/asf/geode-examples.git. at 3e22144 ping pong - CODEOWNERS test No new revisions were added by this update.
[geode-examples] 01/01: Testing a CODEOWNERS file
This is an automated email from the ASF dual-hosted git repository. rhoughton pushed a commit to branch test-code-ownership in repository https://gitbox.apache.org/repos/asf/geode-examples.git commit 403efa3d4f931851c3f0b673dc32b8014fdeb23f Author: Robert Houghton AuthorDate: Fri Oct 30 15:53:14 2020 -0700 Testing a CODEOWNERS file Co-authored-by: Robert Houghton Co-authored-by: Owen Nichols --- CODEOWNERS | 8 1 file changed, 8 insertions(+) diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 000..40e021f --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1,8 @@ +* @upthewaterspout + +/wan @rhoughton-pivot @upthewaterspout +*gradle* @rhoughton-pivot + +/README.md @onichols-pivotal + +# *.jar @apache/geode-committers
[geode-examples] branch test-code-ownership updated (0ee42f0 -> 403efa3)
This is an automated email from the ASF dual-hosted git repository. rhoughton pushed a change to branch test-code-ownership in repository https://gitbox.apache.org/repos/asf/geode-examples.git. omit 0ee42f0 Testing a CODEOWNERS file new 403efa3 Testing a CODEOWNERS file This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (0ee42f0) \ N -- N -- N refs/heads/test-code-ownership (403efa3) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
[geode-examples] branch rhoughton-pivot-patch-1 created (now cf2a688)
This is an automated email from the ASF dual-hosted git repository. rhoughton pushed a change to branch rhoughton-pivot-patch-1 in repository https://gitbox.apache.org/repos/asf/geode-examples.git. at cf2a688 ping pong readme changes! This branch includes the following new commits: new cf2a688 ping pong readme changes! The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
[geode-examples] 01/01: ping pong readme changes!
This is an automated email from the ASF dual-hosted git repository. rhoughton pushed a commit to branch rhoughton-pivot-patch-1 in repository https://gitbox.apache.org/repos/asf/geode-examples.git commit cf2a688360f8da571c6ac6db8d60d4c4ba504768 Author: Robert Houghton AuthorDate: Fri Oct 30 15:55:05 2020 -0700 ping pong readme changes! --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 9046cf3..73245fa 100644 --- a/README.md +++ b/README.md @@ -169,3 +169,6 @@ The following provides more details on the included cryptographic software: The [JCE Unlimited Strength Jurisdiction Policy](http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html) may need to be installed separately to use keystore passwords with 7 or more characters. * Apache Geode links to and uses [OpenSSL](https://www.openssl.org/) ciphers. + + +Edit this and see that Dan and Owen get email.
[geode-examples] 01/01: Testing a CODEOWNERS file
This is an automated email from the ASF dual-hosted git repository. rhoughton pushed a commit to branch test-code-ownership in repository https://gitbox.apache.org/repos/asf/geode-examples.git commit 0ee42f0eec321d3f9ce8dbfdcd0e03f234365d94 Author: Robert Houghton AuthorDate: Fri Oct 30 15:53:14 2020 -0700 Testing a CODEOWNERS file Co-authored-by: Robert Houghton Co-authored-by: Owen Nichols --- CODEOWNERS | 8 1 file changed, 8 insertions(+) diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 000..672032d --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1,8 @@ +* @upthewaterspout + +/wan @rhoughton-pivot +*gradle* @rhoughton-pivot + +/README.md @onichols-pivotal + +# *.jar @apache/geode-committers
[geode-examples] branch test-code-ownership created (now 0ee42f0)
This is an automated email from the ASF dual-hosted git repository. rhoughton pushed a change to branch test-code-ownership in repository https://gitbox.apache.org/repos/asf/geode-examples.git. at 0ee42f0 Testing a CODEOWNERS file This branch includes the following new commits: new 0ee42f0 Testing a CODEOWNERS file The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
[geode-native] branch develop updated: GEODE-8678: Add missing API docs (#684)
This is an automated email from the ASF dual-hosted git repository. mmartell pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode-native.git The following commit(s) were added to refs/heads/develop by this push: new 0d9a99d GEODE-8678: Add missing API docs (#684) 0d9a99d is described below commit 0d9a99d5e0632de62df17921950cf3f6640efb33 Author: Michael Martell AuthorDate: Fri Oct 30 14:35:55 2020 -0700 GEODE-8678: Add missing API docs (#684) For Cache::GetPoolManager() and Cache::GetPoolFactory() --- clicache/src/Cache.hpp | 10 ++ 1 file changed, 10 insertions(+) diff --git a/clicache/src/Cache.hpp b/clicache/src/Cache.hpp index 495ecff..ab7bce4 100644 --- a/clicache/src/Cache.hpp +++ b/clicache/src/Cache.hpp @@ -268,8 +268,18 @@ namespace Apache virtual DataOutput^ Cache::CreateDataOutput(); +/// +/// Returns a PoolFactory that can be used to create a Pool and that provides +/// access to all Pool attributes. +/// @return the PoolFactory +/// virtual PoolFactory^ GetPoolFactory(); +/// +/// Returns a PoolManager that provides for the configuration and creation +/// of instances of PoolFactory. +/// @return the PoolManager +/// virtual PoolManager^ GetPoolManager(); property Apache::Geode::Client::TypeRegistry^ TypeRegistry
[geode] branch support/1.12 updated: GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.12 in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/support/1.12 by this push: new 06642ea GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666) 06642ea is described below commit 06642ead279c500180f396c865b6277cb92ae27d Author: Bill Burcham AuthorDate: Thu Oct 29 16:38:25 2020 -0700 GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666) - NioSslEngine.close() proceeds even if readers (or writers) are operating on its ByteBuffers, allowing Connection.close() to close its socket and proceed. - NioSslEngine.close() needed a lock only on the output buffer, so we split what was a single lock into two. Also instead of using synchronized we use a ReentrantLock so we can call tryLock() and time out if needed in NioSslEngine.close(). - Since readers/writers may hold locks on these input/output buffers when NioSslEngine.close() is called a reference count is maintained and the buffers are returned to the pool only when the last user is done. - To manage the locking and reference counting a new AutoCloseable ByteBufferSharing interface is introduced with a trivial implementation: ByteBufferSharingNoOp and a real implementation: ByteBufferSharingImpl. Co-authored-by: Bill Burcham Co-authored-by: Darrel Schneider Co-authored-by: Ernie Burghardt (cherry picked from commit 08e9e9673d0ed0a3d74c6d16e706817cab09) --- .../tcp/ConnectionCloseSSLTLSDUnitTest.java| 235 .../org/apache/geode/internal/tcp/server.keystore | Bin 0 -> 1256 bytes ...LSocketHostNameVerificationIntegrationTest.java | 4 +- .../internal/net/SSLSocketIntegrationTest.java | 57 +-- .../apache/geode/codeAnalysis/excludedClasses.txt | 1 + .../geode/internal/net/ByteBufferSharing.java | 55 +++ .../geode/internal/net/ByteBufferSharingImpl.java | 148 .../geode/internal/net/ByteBufferSharingNoOp.java | 52 +++ .../org/apache/geode/internal/net/NioFilter.java | 69 ++-- .../apache/geode/internal/net/NioPlainEngine.java | 27 +- .../apache/geode/internal/net/NioSslEngine.java| 357 +- .../org/apache/geode/internal/tcp/Connection.java | 34 +- .../org/apache/geode/internal/tcp/MsgReader.java | 15 +- .../internal/net/ByteBufferSharingImplTest.java| 163 + .../geode/internal/net/NioPlainEngineTest.java | 47 ++- .../geode/internal/net/NioSslEngineTest.java | 397 +++-- 16 files changed, 1199 insertions(+), 462 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java new file mode 100644 index 000..586cd53 --- /dev/null +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java @@ -0,0 +1,235 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.apache.geode.internal.tcp; + +import static java.util.concurrent.TimeUnit.MINUTES; +import static org.apache.geode.distributed.ConfigurationProperties.CONSERVE_SOCKETS; +import static org.apache.geode.distributed.ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION; +import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS; +import static org.apache.geode.distributed.ConfigurationProperties.NAME; +import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_BUFFER_SIZE; +import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_LEASE_TIME; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_ENABLED_COMPONENTS; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE_PASSWORD; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_PROTOCOLS; +import static
[geode] branch support/1.12 updated: GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.12 in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/support/1.12 by this push: new 06642ea GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666) 06642ea is described below commit 06642ead279c500180f396c865b6277cb92ae27d Author: Bill Burcham AuthorDate: Thu Oct 29 16:38:25 2020 -0700 GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666) - NioSslEngine.close() proceeds even if readers (or writers) are operating on its ByteBuffers, allowing Connection.close() to close its socket and proceed. - NioSslEngine.close() needed a lock only on the output buffer, so we split what was a single lock into two. Also instead of using synchronized we use a ReentrantLock so we can call tryLock() and time out if needed in NioSslEngine.close(). - Since readers/writers may hold locks on these input/output buffers when NioSslEngine.close() is called a reference count is maintained and the buffers are returned to the pool only when the last user is done. - To manage the locking and reference counting a new AutoCloseable ByteBufferSharing interface is introduced with a trivial implementation: ByteBufferSharingNoOp and a real implementation: ByteBufferSharingImpl. Co-authored-by: Bill Burcham Co-authored-by: Darrel Schneider Co-authored-by: Ernie Burghardt (cherry picked from commit 08e9e9673d0ed0a3d74c6d16e706817cab09) --- .../tcp/ConnectionCloseSSLTLSDUnitTest.java| 235 .../org/apache/geode/internal/tcp/server.keystore | Bin 0 -> 1256 bytes ...LSocketHostNameVerificationIntegrationTest.java | 4 +- .../internal/net/SSLSocketIntegrationTest.java | 57 +-- .../apache/geode/codeAnalysis/excludedClasses.txt | 1 + .../geode/internal/net/ByteBufferSharing.java | 55 +++ .../geode/internal/net/ByteBufferSharingImpl.java | 148 .../geode/internal/net/ByteBufferSharingNoOp.java | 52 +++ .../org/apache/geode/internal/net/NioFilter.java | 69 ++-- .../apache/geode/internal/net/NioPlainEngine.java | 27 +- .../apache/geode/internal/net/NioSslEngine.java| 357 +- .../org/apache/geode/internal/tcp/Connection.java | 34 +- .../org/apache/geode/internal/tcp/MsgReader.java | 15 +- .../internal/net/ByteBufferSharingImplTest.java| 163 + .../geode/internal/net/NioPlainEngineTest.java | 47 ++- .../geode/internal/net/NioSslEngineTest.java | 397 +++-- 16 files changed, 1199 insertions(+), 462 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java new file mode 100644 index 000..586cd53 --- /dev/null +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java @@ -0,0 +1,235 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.apache.geode.internal.tcp; + +import static java.util.concurrent.TimeUnit.MINUTES; +import static org.apache.geode.distributed.ConfigurationProperties.CONSERVE_SOCKETS; +import static org.apache.geode.distributed.ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION; +import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS; +import static org.apache.geode.distributed.ConfigurationProperties.NAME; +import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_BUFFER_SIZE; +import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_LEASE_TIME; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_ENABLED_COMPONENTS; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE_PASSWORD; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_PROTOCOLS; +import static
[geode] 02/03: GEODE-8540: Create new DistributedBlackboard Rule (#5557)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git commit cde469c6b6955a334e6bbf22accfc0735f0c70f4 Author: Kirk Lund AuthorDate: Wed Sep 30 09:39:30 2020 -0700 GEODE-8540: Create new DistributedBlackboard Rule (#5557) Package up DUnitBlackboard as a JUnit Rule named DistributedBlackboard. (cherry picked from commit 26cb822f2ee467545dd708ecc867cebbd2473c70) --- .../dunit/internal/DUnitBlackboardDUnitTest.java | 75 +++--- .../DistributedBlackboardDistributedTest.java | 297 + .../InternalBlackboard.java => Blackboard.java}| 54 ++-- .../apache/geode/test/dunit/DUnitBlackboard.java | 55 ++-- .../test/dunit/internal/InternalBlackboard.java| 33 ++- .../dunit/internal/InternalBlackboardImpl.java | 59 ++-- .../test/dunit/rules/DistributedBlackboard.java| 138 ++ 7 files changed, 584 insertions(+), 127 deletions(-) diff --git a/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java b/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java index ae78247..5e151d7 100755 --- a/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java +++ b/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java @@ -14,83 +14,70 @@ */ package org.apache.geode.test.dunit.internal; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static java.util.concurrent.TimeUnit.SECONDS; +import static org.apache.geode.test.dunit.VM.getVM; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.catchThrowable; -import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import org.junit.Test; -import org.apache.geode.test.dunit.Host; import org.apache.geode.test.dunit.VM; - +@SuppressWarnings("serial") public class DUnitBlackboardDUnitTest extends JUnit4DistributedTestCase { + @Test - public void canPassDataBetweenVMs() throws Exception { + public void canPassDataBetweenVMs() { final String MBOX = "myMailbox"; -VM vm0 = Host.getHost(0).getVM(0); -VM vm1 = Host.getHost(0).getVM(1); +VM vm0 = getVM(0); +VM vm1 = getVM(1); vm0.invoke("put data in mailbox", () -> getBlackboard().setMailbox(MBOX, "testing")); -String result = (String) vm1.invoke("get data from mailbox", () -> { - return getBlackboard().getMailbox(MBOX); -}); +String result = vm1.invoke("get data from mailbox", () -> getBlackboard().getMailbox(MBOX)); -assertEquals("testing", result); +assertThat(result).isEqualTo("testing"); } @Test - public void canSignalAnotherVM() throws Exception { + public void canSignalAnotherVM() { final String GATE = "myGate"; -VM vm0 = Host.getHost(0).getVM(0); -VM vm1 = Host.getHost(0).getVM(1); +VM vm0 = getVM(0); +VM vm1 = getVM(1); vm1.invoke("wait on gate not yet signalled", () -> { - assertFalse(getBlackboard().isGateSignaled(GATE)); - try { -getBlackboard().waitForGate(GATE, 1, TimeUnit.SECONDS); - } catch (TimeoutException e) { -// expected -return; - } catch (InterruptedException e) { -fail("unexpected interrupt"); - } - fail("unexpected success"); + assertThat(getBlackboard().isGateSignaled(GATE)).isFalse(); + + Throwable thrown = catchThrowable(() -> { +getBlackboard().waitForGate(GATE, 1, SECONDS); + }); + + assertThat(thrown).isInstanceOf(TimeoutException.class); }); vm0.invoke("signal gate", () -> getBlackboard().signalGate(GATE)); -vm1.invoke("wait on gate not yet signalled", () -> { - try { -getBlackboard().waitForGate(GATE, 1, TimeUnit.SECONDS); - } catch (TimeoutException e) { -fail("unexpected timeout"); - } catch (InterruptedException e) { -fail("unexpected interrupt"); - } - // success expected -}); +vm1.invoke("wait on gate not yet signalled", +() -> getBlackboard().waitForGate(GATE, 1, SECONDS)); } @Test - public void initBlackboardClearsEverything() throws Exception { + public void initBlackboardClearsEverything() { for (int i = 0; i < 100; i++) { getBlackboard().setMailbox("MBOX" + i, "value" + i); - assertEquals("value" + i, getBlackboard().getMailbox("MBOX" + i)); + assertThat((Object) getBlackboard().getMailbox("MBOX" + i)).isEqualTo("value" + i); + getBlackboard().signalGate("GATE" + i); - assertTrue(getBlackboard().isGateSignaled("GATE" + i)); +
[geode] branch support/1.13 updated (174c7cb -> b2af727)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a change to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git. from 174c7cb GEODE-8651: MsgReader's readHeader and readMessage should be synchron… (#5665) new 10af7ea GEODE-8136: Move UncheckedUtils to geode-common (#5123) new cde469c GEODE-8540: Create new DistributedBlackboard Rule (#5557) new b2af727 GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666) The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../geode/util/internal}/UncheckedUtils.java | 19 +- .../geode/util/internal/UncheckedUtilsTest.java| 60 .../cache/PartitionedRegionSingleHopDUnitTest.java | 14 +- ...istributedRegionFunctionExecutionDUnitTest.java | 59 +--- ...oningWithColocationAndPersistenceDUnitTest.java | 12 +- .../tcp/ConnectionCloseSSLTLSDUnitTest.java| 238 + .../org/apache/geode/internal/tcp}/server.keystore | Bin .../FunctionExecutionOnLonerRegressionTest.java| 27 +- ...LSocketHostNameVerificationIntegrationTest.java | 4 +- .../internal/net/SSLSocketIntegrationTest.java | 57 +-- .../apache/geode/codeAnalysis/excludedClasses.txt | 1 + .../client/internal/ClientMetadataService.java | 4 +- .../geode/internal/cache/GemFireCacheImpl.java | 49 +-- .../cache/InternalCacheForClientAccess.java| 6 +- .../apache/geode/internal/cache/LocalRegion.java | 7 +- .../util/TypedFunctionService.java}| 20 +- .../tier/sockets/CacheClientProxyFactory.java | 4 +- .../geode/internal/net/ByteBufferSharing.java | 55 +++ .../geode/internal/net/ByteBufferSharingImpl.java | 148 .../geode/internal/net/ByteBufferSharingNoOp.java | 52 +++ .../org/apache/geode/internal/net/NioFilter.java | 69 ++-- .../apache/geode/internal/net/NioPlainEngine.java | 27 +- .../apache/geode/internal/net/NioSslEngine.java| 353 ++- .../org/apache/geode/internal/tcp/Connection.java | 34 +- .../org/apache/geode/internal/tcp/MsgReader.java | 15 +- .../internal/ClusterAlertMessagingTest.java| 6 +- .../internal/net/ByteBufferSharingImplTest.java| 163 + .../geode/internal/net/NioPlainEngineTest.java | 47 ++- .../geode/internal/net/NioSslEngineTest.java | 392 +++-- .../apache/geode/internal/tcp/TCPConduitTest.java | 4 +- .../dunit/internal/DUnitBlackboardDUnitTest.java | 75 ++-- .../DistributedBlackboardDistributedTest.java | 297 .../InternalBlackboard.java => Blackboard.java}| 54 +-- .../apache/geode/test/dunit/DUnitBlackboard.java | 55 +-- .../test/dunit/internal/InternalBlackboard.java| 33 +- .../dunit/internal/InternalBlackboardImpl.java | 59 +++- .../test/dunit/rules/DistributedBlackboard.java| 138 37 files changed, 1930 insertions(+), 727 deletions(-) copy {geode-core/src/main/java/org/apache/geode/internal/cache/util => geode-common/src/main/java/org/apache/geode/util/internal}/UncheckedUtils.java (68%) create mode 100644 geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java create mode 100644 geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java copy {geode-dunit/src/main/resources/org/apache/geode => geode-core/src/distributedTest/resources/org/apache/geode/internal/tcp}/server.keystore (100%) rename geode-core/src/main/java/org/apache/geode/internal/cache/{util/UncheckedUtils.java => execute/util/TypedFunctionService.java} (61%) create mode 100644 geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharing.java create mode 100644 geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingImpl.java create mode 100644 geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingNoOp.java create mode 100644 geode-core/src/test/java/org/apache/geode/internal/net/ByteBufferSharingImplTest.java create mode 100644 geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/rules/tests/DistributedBlackboardDistributedTest.java copy geode-dunit/src/main/java/org/apache/geode/test/dunit/{internal/InternalBlackboard.java => Blackboard.java} (51%) mode change 100755 => 100644 create mode 100644 geode-dunit/src/main/java/org/apache/geode/test/dunit/rules/DistributedBlackboard.java
[geode] 01/03: GEODE-8136: Move UncheckedUtils to geode-common (#5123)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git commit 10af7ea015ec85ef02b2e972c7a3dd3ec23bcb7f Author: Kirk Lund AuthorDate: Tue May 26 10:24:44 2020 -0700 GEODE-8136: Move UncheckedUtils to geode-common (#5123) Create UncheckedUtilsTest to unit test UncheckedUtils. Extract FunctionExecution methods to new TypedFunctionService in geode-core. (cherry picked from commit 253d667b27423e55601e925f7a20f2fd6f0efc31) --- .../geode/util/internal}/UncheckedUtils.java | 19 --- .../geode/util/internal/UncheckedUtilsTest.java| 60 ++ .../cache/PartitionedRegionSingleHopDUnitTest.java | 14 ++--- ...istributedRegionFunctionExecutionDUnitTest.java | 59 +++-- ...oningWithColocationAndPersistenceDUnitTest.java | 12 ++--- .../FunctionExecutionOnLonerRegressionTest.java| 27 ++ .../client/internal/ClientMetadataService.java | 4 +- .../geode/internal/cache/GemFireCacheImpl.java | 49 -- .../cache/InternalCacheForClientAccess.java| 6 +-- .../apache/geode/internal/cache/LocalRegion.java | 7 ++- .../util/TypedFunctionService.java}| 20 +--- .../tier/sockets/CacheClientProxyFactory.java | 4 +- .../internal/ClusterAlertMessagingTest.java| 6 +-- .../apache/geode/internal/tcp/TCPConduitTest.java | 4 +- 14 files changed, 151 insertions(+), 140 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/util/UncheckedUtils.java b/geode-common/src/main/java/org/apache/geode/util/internal/UncheckedUtils.java similarity index 68% copy from geode-core/src/main/java/org/apache/geode/internal/cache/util/UncheckedUtils.java copy to geode-common/src/main/java/org/apache/geode/util/internal/UncheckedUtils.java index c03e990..61dbd8d 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/util/UncheckedUtils.java +++ b/geode-common/src/main/java/org/apache/geode/util/internal/UncheckedUtils.java @@ -12,18 +12,23 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ -package org.apache.geode.internal.cache.util; - -import org.apache.geode.cache.execute.Execution; +package org.apache.geode.util.internal; +/** + * Utilities for casting and working with unchecked raw types. + */ @SuppressWarnings({"unchecked", "unused"}) public class UncheckedUtils { - public static T cast(Object object) { -return (T) object; + protected UncheckedUtils() { +// do not instantiate } - public static Execution cast(Execution execution) { -return execution; + /** + * Casts an instance of a raw type to a parameterized type. Preference should be given to + * converting all code from using raw types to using parameterized types when possible. + */ + public static T uncheckedCast(Object object) { +return (T) object; } } diff --git a/geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java b/geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java new file mode 100644 index 000..7c282b7 --- /dev/null +++ b/geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java @@ -0,0 +1,60 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ +package org.apache.geode.util.internal; + +import static org.apache.geode.util.internal.UncheckedUtils.uncheckedCast; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.catchThrowable; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Test; + +@SuppressWarnings("unchecked") +public class UncheckedUtilsTest { + + @Test + public void uncheckedCast_rawList_empty() { +List rawList = new ArrayList(); + +List value = uncheckedCast(rawList); + +assertThat(value).isSameAs(rawList); + } + + @Test + public void uncheckedCast_rawList_nonEmpty() { +List rawList = new ArrayList(); +rawList.add("1"); +rawList.add("2"); + +List value =
[geode] 03/03: GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git commit b2af727ce23fd155f3665e3db2ecee6e8f80fba7 Author: Bill Burcham AuthorDate: Thu Oct 29 16:38:25 2020 -0700 GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666) - NioSslEngine.close() proceeds even if readers (or writers) are operating on its ByteBuffers, allowing Connection.close() to close its socket and proceed. - NioSslEngine.close() needed a lock only on the output buffer, so we split what was a single lock into two. Also instead of using synchronized we use a ReentrantLock so we can call tryLock() and time out if needed in NioSslEngine.close(). - Since readers/writers may hold locks on these input/output buffers when NioSslEngine.close() is called a reference count is maintained and the buffers are returned to the pool only when the last user is done. - To manage the locking and reference counting a new AutoCloseable ByteBufferSharing interface is introduced with a trivial implementation: ByteBufferSharingNoOp and a real implementation: ByteBufferSharingImpl. Co-authored-by: Bill Burcham Co-authored-by: Darrel Schneider Co-authored-by: Ernie Burghardt (cherry picked from commit 08e9e9673d0ed0a3d74c6d16e706817cab09) --- .../tcp/ConnectionCloseSSLTLSDUnitTest.java| 238 + .../org/apache/geode/internal/tcp/server.keystore | Bin 0 -> 1256 bytes ...LSocketHostNameVerificationIntegrationTest.java | 4 +- .../internal/net/SSLSocketIntegrationTest.java | 57 +-- .../apache/geode/codeAnalysis/excludedClasses.txt | 1 + .../geode/internal/net/ByteBufferSharing.java | 55 +++ .../geode/internal/net/ByteBufferSharingImpl.java | 148 .../geode/internal/net/ByteBufferSharingNoOp.java | 52 +++ .../org/apache/geode/internal/net/NioFilter.java | 69 ++-- .../apache/geode/internal/net/NioPlainEngine.java | 27 +- .../apache/geode/internal/net/NioSslEngine.java| 353 ++- .../org/apache/geode/internal/tcp/Connection.java | 34 +- .../org/apache/geode/internal/tcp/MsgReader.java | 15 +- .../internal/net/ByteBufferSharingImplTest.java| 163 + .../geode/internal/net/NioPlainEngineTest.java | 47 ++- .../geode/internal/net/NioSslEngineTest.java | 392 +++-- 16 files changed, 1195 insertions(+), 460 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java new file mode 100644 index 000..77fe9bf --- /dev/null +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java @@ -0,0 +1,238 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.apache.geode.internal.tcp; + +import static org.apache.geode.distributed.ConfigurationProperties.CONSERVE_SOCKETS; +import static org.apache.geode.distributed.ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION; +import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS; +import static org.apache.geode.distributed.ConfigurationProperties.NAME; +import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_BUFFER_SIZE; +import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_LEASE_TIME; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_ENABLED_COMPONENTS; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE_PASSWORD; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_PROTOCOLS; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_REQUIRE_AUTHENTICATION; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_TRUSTSTORE; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_TRUSTSTORE_PASSWORD; +import static
[geode] branch support/1.12 updated: GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.12 in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/support/1.12 by this push: new 06642ea GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666) 06642ea is described below commit 06642ead279c500180f396c865b6277cb92ae27d Author: Bill Burcham AuthorDate: Thu Oct 29 16:38:25 2020 -0700 GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666) - NioSslEngine.close() proceeds even if readers (or writers) are operating on its ByteBuffers, allowing Connection.close() to close its socket and proceed. - NioSslEngine.close() needed a lock only on the output buffer, so we split what was a single lock into two. Also instead of using synchronized we use a ReentrantLock so we can call tryLock() and time out if needed in NioSslEngine.close(). - Since readers/writers may hold locks on these input/output buffers when NioSslEngine.close() is called a reference count is maintained and the buffers are returned to the pool only when the last user is done. - To manage the locking and reference counting a new AutoCloseable ByteBufferSharing interface is introduced with a trivial implementation: ByteBufferSharingNoOp and a real implementation: ByteBufferSharingImpl. Co-authored-by: Bill Burcham Co-authored-by: Darrel Schneider Co-authored-by: Ernie Burghardt (cherry picked from commit 08e9e9673d0ed0a3d74c6d16e706817cab09) --- .../tcp/ConnectionCloseSSLTLSDUnitTest.java| 235 .../org/apache/geode/internal/tcp/server.keystore | Bin 0 -> 1256 bytes ...LSocketHostNameVerificationIntegrationTest.java | 4 +- .../internal/net/SSLSocketIntegrationTest.java | 57 +-- .../apache/geode/codeAnalysis/excludedClasses.txt | 1 + .../geode/internal/net/ByteBufferSharing.java | 55 +++ .../geode/internal/net/ByteBufferSharingImpl.java | 148 .../geode/internal/net/ByteBufferSharingNoOp.java | 52 +++ .../org/apache/geode/internal/net/NioFilter.java | 69 ++-- .../apache/geode/internal/net/NioPlainEngine.java | 27 +- .../apache/geode/internal/net/NioSslEngine.java| 357 +- .../org/apache/geode/internal/tcp/Connection.java | 34 +- .../org/apache/geode/internal/tcp/MsgReader.java | 15 +- .../internal/net/ByteBufferSharingImplTest.java| 163 + .../geode/internal/net/NioPlainEngineTest.java | 47 ++- .../geode/internal/net/NioSslEngineTest.java | 397 +++-- 16 files changed, 1199 insertions(+), 462 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java new file mode 100644 index 000..586cd53 --- /dev/null +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java @@ -0,0 +1,235 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.apache.geode.internal.tcp; + +import static java.util.concurrent.TimeUnit.MINUTES; +import static org.apache.geode.distributed.ConfigurationProperties.CONSERVE_SOCKETS; +import static org.apache.geode.distributed.ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION; +import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS; +import static org.apache.geode.distributed.ConfigurationProperties.NAME; +import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_BUFFER_SIZE; +import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_LEASE_TIME; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_ENABLED_COMPONENTS; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE_PASSWORD; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_PROTOCOLS; +import static
[geode] branch support/1.13 updated (174c7cb -> b2af727)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a change to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git. from 174c7cb GEODE-8651: MsgReader's readHeader and readMessage should be synchron… (#5665) new 10af7ea GEODE-8136: Move UncheckedUtils to geode-common (#5123) new cde469c GEODE-8540: Create new DistributedBlackboard Rule (#5557) new b2af727 GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666) The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../geode/util/internal}/UncheckedUtils.java | 19 +- .../geode/util/internal/UncheckedUtilsTest.java| 60 .../cache/PartitionedRegionSingleHopDUnitTest.java | 14 +- ...istributedRegionFunctionExecutionDUnitTest.java | 59 +--- ...oningWithColocationAndPersistenceDUnitTest.java | 12 +- .../tcp/ConnectionCloseSSLTLSDUnitTest.java| 238 + .../org/apache/geode/internal/tcp}/server.keystore | Bin .../FunctionExecutionOnLonerRegressionTest.java| 27 +- ...LSocketHostNameVerificationIntegrationTest.java | 4 +- .../internal/net/SSLSocketIntegrationTest.java | 57 +-- .../apache/geode/codeAnalysis/excludedClasses.txt | 1 + .../client/internal/ClientMetadataService.java | 4 +- .../geode/internal/cache/GemFireCacheImpl.java | 49 +-- .../cache/InternalCacheForClientAccess.java| 6 +- .../apache/geode/internal/cache/LocalRegion.java | 7 +- .../util/TypedFunctionService.java}| 20 +- .../tier/sockets/CacheClientProxyFactory.java | 4 +- .../geode/internal/net/ByteBufferSharing.java | 55 +++ .../geode/internal/net/ByteBufferSharingImpl.java | 148 .../geode/internal/net/ByteBufferSharingNoOp.java | 52 +++ .../org/apache/geode/internal/net/NioFilter.java | 69 ++-- .../apache/geode/internal/net/NioPlainEngine.java | 27 +- .../apache/geode/internal/net/NioSslEngine.java| 353 ++- .../org/apache/geode/internal/tcp/Connection.java | 34 +- .../org/apache/geode/internal/tcp/MsgReader.java | 15 +- .../internal/ClusterAlertMessagingTest.java| 6 +- .../internal/net/ByteBufferSharingImplTest.java| 163 + .../geode/internal/net/NioPlainEngineTest.java | 47 ++- .../geode/internal/net/NioSslEngineTest.java | 392 +++-- .../apache/geode/internal/tcp/TCPConduitTest.java | 4 +- .../dunit/internal/DUnitBlackboardDUnitTest.java | 75 ++-- .../DistributedBlackboardDistributedTest.java | 297 .../InternalBlackboard.java => Blackboard.java}| 54 +-- .../apache/geode/test/dunit/DUnitBlackboard.java | 55 +-- .../test/dunit/internal/InternalBlackboard.java| 33 +- .../dunit/internal/InternalBlackboardImpl.java | 59 +++- .../test/dunit/rules/DistributedBlackboard.java| 138 37 files changed, 1930 insertions(+), 727 deletions(-) copy {geode-core/src/main/java/org/apache/geode/internal/cache/util => geode-common/src/main/java/org/apache/geode/util/internal}/UncheckedUtils.java (68%) create mode 100644 geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java create mode 100644 geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java copy {geode-dunit/src/main/resources/org/apache/geode => geode-core/src/distributedTest/resources/org/apache/geode/internal/tcp}/server.keystore (100%) rename geode-core/src/main/java/org/apache/geode/internal/cache/{util/UncheckedUtils.java => execute/util/TypedFunctionService.java} (61%) create mode 100644 geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharing.java create mode 100644 geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingImpl.java create mode 100644 geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingNoOp.java create mode 100644 geode-core/src/test/java/org/apache/geode/internal/net/ByteBufferSharingImplTest.java create mode 100644 geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/rules/tests/DistributedBlackboardDistributedTest.java copy geode-dunit/src/main/java/org/apache/geode/test/dunit/{internal/InternalBlackboard.java => Blackboard.java} (51%) mode change 100755 => 100644 create mode 100644 geode-dunit/src/main/java/org/apache/geode/test/dunit/rules/DistributedBlackboard.java
[geode] 03/03: GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git commit b2af727ce23fd155f3665e3db2ecee6e8f80fba7 Author: Bill Burcham AuthorDate: Thu Oct 29 16:38:25 2020 -0700 GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666) - NioSslEngine.close() proceeds even if readers (or writers) are operating on its ByteBuffers, allowing Connection.close() to close its socket and proceed. - NioSslEngine.close() needed a lock only on the output buffer, so we split what was a single lock into two. Also instead of using synchronized we use a ReentrantLock so we can call tryLock() and time out if needed in NioSslEngine.close(). - Since readers/writers may hold locks on these input/output buffers when NioSslEngine.close() is called a reference count is maintained and the buffers are returned to the pool only when the last user is done. - To manage the locking and reference counting a new AutoCloseable ByteBufferSharing interface is introduced with a trivial implementation: ByteBufferSharingNoOp and a real implementation: ByteBufferSharingImpl. Co-authored-by: Bill Burcham Co-authored-by: Darrel Schneider Co-authored-by: Ernie Burghardt (cherry picked from commit 08e9e9673d0ed0a3d74c6d16e706817cab09) --- .../tcp/ConnectionCloseSSLTLSDUnitTest.java| 238 + .../org/apache/geode/internal/tcp/server.keystore | Bin 0 -> 1256 bytes ...LSocketHostNameVerificationIntegrationTest.java | 4 +- .../internal/net/SSLSocketIntegrationTest.java | 57 +-- .../apache/geode/codeAnalysis/excludedClasses.txt | 1 + .../geode/internal/net/ByteBufferSharing.java | 55 +++ .../geode/internal/net/ByteBufferSharingImpl.java | 148 .../geode/internal/net/ByteBufferSharingNoOp.java | 52 +++ .../org/apache/geode/internal/net/NioFilter.java | 69 ++-- .../apache/geode/internal/net/NioPlainEngine.java | 27 +- .../apache/geode/internal/net/NioSslEngine.java| 353 ++- .../org/apache/geode/internal/tcp/Connection.java | 34 +- .../org/apache/geode/internal/tcp/MsgReader.java | 15 +- .../internal/net/ByteBufferSharingImplTest.java| 163 + .../geode/internal/net/NioPlainEngineTest.java | 47 ++- .../geode/internal/net/NioSslEngineTest.java | 392 +++-- 16 files changed, 1195 insertions(+), 460 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java new file mode 100644 index 000..77fe9bf --- /dev/null +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java @@ -0,0 +1,238 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.apache.geode.internal.tcp; + +import static org.apache.geode.distributed.ConfigurationProperties.CONSERVE_SOCKETS; +import static org.apache.geode.distributed.ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION; +import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS; +import static org.apache.geode.distributed.ConfigurationProperties.NAME; +import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_BUFFER_SIZE; +import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_LEASE_TIME; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_ENABLED_COMPONENTS; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE_PASSWORD; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_PROTOCOLS; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_REQUIRE_AUTHENTICATION; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_TRUSTSTORE; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_TRUSTSTORE_PASSWORD; +import static
[geode] 02/03: GEODE-8540: Create new DistributedBlackboard Rule (#5557)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git commit cde469c6b6955a334e6bbf22accfc0735f0c70f4 Author: Kirk Lund AuthorDate: Wed Sep 30 09:39:30 2020 -0700 GEODE-8540: Create new DistributedBlackboard Rule (#5557) Package up DUnitBlackboard as a JUnit Rule named DistributedBlackboard. (cherry picked from commit 26cb822f2ee467545dd708ecc867cebbd2473c70) --- .../dunit/internal/DUnitBlackboardDUnitTest.java | 75 +++--- .../DistributedBlackboardDistributedTest.java | 297 + .../InternalBlackboard.java => Blackboard.java}| 54 ++-- .../apache/geode/test/dunit/DUnitBlackboard.java | 55 ++-- .../test/dunit/internal/InternalBlackboard.java| 33 ++- .../dunit/internal/InternalBlackboardImpl.java | 59 ++-- .../test/dunit/rules/DistributedBlackboard.java| 138 ++ 7 files changed, 584 insertions(+), 127 deletions(-) diff --git a/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java b/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java index ae78247..5e151d7 100755 --- a/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java +++ b/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java @@ -14,83 +14,70 @@ */ package org.apache.geode.test.dunit.internal; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static java.util.concurrent.TimeUnit.SECONDS; +import static org.apache.geode.test.dunit.VM.getVM; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.catchThrowable; -import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import org.junit.Test; -import org.apache.geode.test.dunit.Host; import org.apache.geode.test.dunit.VM; - +@SuppressWarnings("serial") public class DUnitBlackboardDUnitTest extends JUnit4DistributedTestCase { + @Test - public void canPassDataBetweenVMs() throws Exception { + public void canPassDataBetweenVMs() { final String MBOX = "myMailbox"; -VM vm0 = Host.getHost(0).getVM(0); -VM vm1 = Host.getHost(0).getVM(1); +VM vm0 = getVM(0); +VM vm1 = getVM(1); vm0.invoke("put data in mailbox", () -> getBlackboard().setMailbox(MBOX, "testing")); -String result = (String) vm1.invoke("get data from mailbox", () -> { - return getBlackboard().getMailbox(MBOX); -}); +String result = vm1.invoke("get data from mailbox", () -> getBlackboard().getMailbox(MBOX)); -assertEquals("testing", result); +assertThat(result).isEqualTo("testing"); } @Test - public void canSignalAnotherVM() throws Exception { + public void canSignalAnotherVM() { final String GATE = "myGate"; -VM vm0 = Host.getHost(0).getVM(0); -VM vm1 = Host.getHost(0).getVM(1); +VM vm0 = getVM(0); +VM vm1 = getVM(1); vm1.invoke("wait on gate not yet signalled", () -> { - assertFalse(getBlackboard().isGateSignaled(GATE)); - try { -getBlackboard().waitForGate(GATE, 1, TimeUnit.SECONDS); - } catch (TimeoutException e) { -// expected -return; - } catch (InterruptedException e) { -fail("unexpected interrupt"); - } - fail("unexpected success"); + assertThat(getBlackboard().isGateSignaled(GATE)).isFalse(); + + Throwable thrown = catchThrowable(() -> { +getBlackboard().waitForGate(GATE, 1, SECONDS); + }); + + assertThat(thrown).isInstanceOf(TimeoutException.class); }); vm0.invoke("signal gate", () -> getBlackboard().signalGate(GATE)); -vm1.invoke("wait on gate not yet signalled", () -> { - try { -getBlackboard().waitForGate(GATE, 1, TimeUnit.SECONDS); - } catch (TimeoutException e) { -fail("unexpected timeout"); - } catch (InterruptedException e) { -fail("unexpected interrupt"); - } - // success expected -}); +vm1.invoke("wait on gate not yet signalled", +() -> getBlackboard().waitForGate(GATE, 1, SECONDS)); } @Test - public void initBlackboardClearsEverything() throws Exception { + public void initBlackboardClearsEverything() { for (int i = 0; i < 100; i++) { getBlackboard().setMailbox("MBOX" + i, "value" + i); - assertEquals("value" + i, getBlackboard().getMailbox("MBOX" + i)); + assertThat((Object) getBlackboard().getMailbox("MBOX" + i)).isEqualTo("value" + i); + getBlackboard().signalGate("GATE" + i); - assertTrue(getBlackboard().isGateSignaled("GATE" + i)); +
[geode] 01/03: GEODE-8136: Move UncheckedUtils to geode-common (#5123)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git commit 10af7ea015ec85ef02b2e972c7a3dd3ec23bcb7f Author: Kirk Lund AuthorDate: Tue May 26 10:24:44 2020 -0700 GEODE-8136: Move UncheckedUtils to geode-common (#5123) Create UncheckedUtilsTest to unit test UncheckedUtils. Extract FunctionExecution methods to new TypedFunctionService in geode-core. (cherry picked from commit 253d667b27423e55601e925f7a20f2fd6f0efc31) --- .../geode/util/internal}/UncheckedUtils.java | 19 --- .../geode/util/internal/UncheckedUtilsTest.java| 60 ++ .../cache/PartitionedRegionSingleHopDUnitTest.java | 14 ++--- ...istributedRegionFunctionExecutionDUnitTest.java | 59 +++-- ...oningWithColocationAndPersistenceDUnitTest.java | 12 ++--- .../FunctionExecutionOnLonerRegressionTest.java| 27 ++ .../client/internal/ClientMetadataService.java | 4 +- .../geode/internal/cache/GemFireCacheImpl.java | 49 -- .../cache/InternalCacheForClientAccess.java| 6 +-- .../apache/geode/internal/cache/LocalRegion.java | 7 ++- .../util/TypedFunctionService.java}| 20 +--- .../tier/sockets/CacheClientProxyFactory.java | 4 +- .../internal/ClusterAlertMessagingTest.java| 6 +-- .../apache/geode/internal/tcp/TCPConduitTest.java | 4 +- 14 files changed, 151 insertions(+), 140 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/util/UncheckedUtils.java b/geode-common/src/main/java/org/apache/geode/util/internal/UncheckedUtils.java similarity index 68% copy from geode-core/src/main/java/org/apache/geode/internal/cache/util/UncheckedUtils.java copy to geode-common/src/main/java/org/apache/geode/util/internal/UncheckedUtils.java index c03e990..61dbd8d 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/util/UncheckedUtils.java +++ b/geode-common/src/main/java/org/apache/geode/util/internal/UncheckedUtils.java @@ -12,18 +12,23 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ -package org.apache.geode.internal.cache.util; - -import org.apache.geode.cache.execute.Execution; +package org.apache.geode.util.internal; +/** + * Utilities for casting and working with unchecked raw types. + */ @SuppressWarnings({"unchecked", "unused"}) public class UncheckedUtils { - public static T cast(Object object) { -return (T) object; + protected UncheckedUtils() { +// do not instantiate } - public static Execution cast(Execution execution) { -return execution; + /** + * Casts an instance of a raw type to a parameterized type. Preference should be given to + * converting all code from using raw types to using parameterized types when possible. + */ + public static T uncheckedCast(Object object) { +return (T) object; } } diff --git a/geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java b/geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java new file mode 100644 index 000..7c282b7 --- /dev/null +++ b/geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java @@ -0,0 +1,60 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ +package org.apache.geode.util.internal; + +import static org.apache.geode.util.internal.UncheckedUtils.uncheckedCast; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.catchThrowable; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Test; + +@SuppressWarnings("unchecked") +public class UncheckedUtilsTest { + + @Test + public void uncheckedCast_rawList_empty() { +List rawList = new ArrayList(); + +List value = uncheckedCast(rawList); + +assertThat(value).isSameAs(rawList); + } + + @Test + public void uncheckedCast_rawList_nonEmpty() { +List rawList = new ArrayList(); +rawList.add("1"); +rawList.add("2"); + +List value =
[geode] branch support/1.12 updated: GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.12 in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/support/1.12 by this push: new 06642ea GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666) 06642ea is described below commit 06642ead279c500180f396c865b6277cb92ae27d Author: Bill Burcham AuthorDate: Thu Oct 29 16:38:25 2020 -0700 GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666) - NioSslEngine.close() proceeds even if readers (or writers) are operating on its ByteBuffers, allowing Connection.close() to close its socket and proceed. - NioSslEngine.close() needed a lock only on the output buffer, so we split what was a single lock into two. Also instead of using synchronized we use a ReentrantLock so we can call tryLock() and time out if needed in NioSslEngine.close(). - Since readers/writers may hold locks on these input/output buffers when NioSslEngine.close() is called a reference count is maintained and the buffers are returned to the pool only when the last user is done. - To manage the locking and reference counting a new AutoCloseable ByteBufferSharing interface is introduced with a trivial implementation: ByteBufferSharingNoOp and a real implementation: ByteBufferSharingImpl. Co-authored-by: Bill Burcham Co-authored-by: Darrel Schneider Co-authored-by: Ernie Burghardt (cherry picked from commit 08e9e9673d0ed0a3d74c6d16e706817cab09) --- .../tcp/ConnectionCloseSSLTLSDUnitTest.java| 235 .../org/apache/geode/internal/tcp/server.keystore | Bin 0 -> 1256 bytes ...LSocketHostNameVerificationIntegrationTest.java | 4 +- .../internal/net/SSLSocketIntegrationTest.java | 57 +-- .../apache/geode/codeAnalysis/excludedClasses.txt | 1 + .../geode/internal/net/ByteBufferSharing.java | 55 +++ .../geode/internal/net/ByteBufferSharingImpl.java | 148 .../geode/internal/net/ByteBufferSharingNoOp.java | 52 +++ .../org/apache/geode/internal/net/NioFilter.java | 69 ++-- .../apache/geode/internal/net/NioPlainEngine.java | 27 +- .../apache/geode/internal/net/NioSslEngine.java| 357 +- .../org/apache/geode/internal/tcp/Connection.java | 34 +- .../org/apache/geode/internal/tcp/MsgReader.java | 15 +- .../internal/net/ByteBufferSharingImplTest.java| 163 + .../geode/internal/net/NioPlainEngineTest.java | 47 ++- .../geode/internal/net/NioSslEngineTest.java | 397 +++-- 16 files changed, 1199 insertions(+), 462 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java new file mode 100644 index 000..586cd53 --- /dev/null +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java @@ -0,0 +1,235 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.apache.geode.internal.tcp; + +import static java.util.concurrent.TimeUnit.MINUTES; +import static org.apache.geode.distributed.ConfigurationProperties.CONSERVE_SOCKETS; +import static org.apache.geode.distributed.ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION; +import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS; +import static org.apache.geode.distributed.ConfigurationProperties.NAME; +import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_BUFFER_SIZE; +import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_LEASE_TIME; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_ENABLED_COMPONENTS; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE_PASSWORD; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_PROTOCOLS; +import static
[geode] 02/03: GEODE-8540: Create new DistributedBlackboard Rule (#5557)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git commit cde469c6b6955a334e6bbf22accfc0735f0c70f4 Author: Kirk Lund AuthorDate: Wed Sep 30 09:39:30 2020 -0700 GEODE-8540: Create new DistributedBlackboard Rule (#5557) Package up DUnitBlackboard as a JUnit Rule named DistributedBlackboard. (cherry picked from commit 26cb822f2ee467545dd708ecc867cebbd2473c70) --- .../dunit/internal/DUnitBlackboardDUnitTest.java | 75 +++--- .../DistributedBlackboardDistributedTest.java | 297 + .../InternalBlackboard.java => Blackboard.java}| 54 ++-- .../apache/geode/test/dunit/DUnitBlackboard.java | 55 ++-- .../test/dunit/internal/InternalBlackboard.java| 33 ++- .../dunit/internal/InternalBlackboardImpl.java | 59 ++-- .../test/dunit/rules/DistributedBlackboard.java| 138 ++ 7 files changed, 584 insertions(+), 127 deletions(-) diff --git a/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java b/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java index ae78247..5e151d7 100755 --- a/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java +++ b/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java @@ -14,83 +14,70 @@ */ package org.apache.geode.test.dunit.internal; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static java.util.concurrent.TimeUnit.SECONDS; +import static org.apache.geode.test.dunit.VM.getVM; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.catchThrowable; -import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import org.junit.Test; -import org.apache.geode.test.dunit.Host; import org.apache.geode.test.dunit.VM; - +@SuppressWarnings("serial") public class DUnitBlackboardDUnitTest extends JUnit4DistributedTestCase { + @Test - public void canPassDataBetweenVMs() throws Exception { + public void canPassDataBetweenVMs() { final String MBOX = "myMailbox"; -VM vm0 = Host.getHost(0).getVM(0); -VM vm1 = Host.getHost(0).getVM(1); +VM vm0 = getVM(0); +VM vm1 = getVM(1); vm0.invoke("put data in mailbox", () -> getBlackboard().setMailbox(MBOX, "testing")); -String result = (String) vm1.invoke("get data from mailbox", () -> { - return getBlackboard().getMailbox(MBOX); -}); +String result = vm1.invoke("get data from mailbox", () -> getBlackboard().getMailbox(MBOX)); -assertEquals("testing", result); +assertThat(result).isEqualTo("testing"); } @Test - public void canSignalAnotherVM() throws Exception { + public void canSignalAnotherVM() { final String GATE = "myGate"; -VM vm0 = Host.getHost(0).getVM(0); -VM vm1 = Host.getHost(0).getVM(1); +VM vm0 = getVM(0); +VM vm1 = getVM(1); vm1.invoke("wait on gate not yet signalled", () -> { - assertFalse(getBlackboard().isGateSignaled(GATE)); - try { -getBlackboard().waitForGate(GATE, 1, TimeUnit.SECONDS); - } catch (TimeoutException e) { -// expected -return; - } catch (InterruptedException e) { -fail("unexpected interrupt"); - } - fail("unexpected success"); + assertThat(getBlackboard().isGateSignaled(GATE)).isFalse(); + + Throwable thrown = catchThrowable(() -> { +getBlackboard().waitForGate(GATE, 1, SECONDS); + }); + + assertThat(thrown).isInstanceOf(TimeoutException.class); }); vm0.invoke("signal gate", () -> getBlackboard().signalGate(GATE)); -vm1.invoke("wait on gate not yet signalled", () -> { - try { -getBlackboard().waitForGate(GATE, 1, TimeUnit.SECONDS); - } catch (TimeoutException e) { -fail("unexpected timeout"); - } catch (InterruptedException e) { -fail("unexpected interrupt"); - } - // success expected -}); +vm1.invoke("wait on gate not yet signalled", +() -> getBlackboard().waitForGate(GATE, 1, SECONDS)); } @Test - public void initBlackboardClearsEverything() throws Exception { + public void initBlackboardClearsEverything() { for (int i = 0; i < 100; i++) { getBlackboard().setMailbox("MBOX" + i, "value" + i); - assertEquals("value" + i, getBlackboard().getMailbox("MBOX" + i)); + assertThat((Object) getBlackboard().getMailbox("MBOX" + i)).isEqualTo("value" + i); + getBlackboard().signalGate("GATE" + i); - assertTrue(getBlackboard().isGateSignaled("GATE" + i)); +
[geode] branch support/1.13 updated (174c7cb -> b2af727)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a change to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git. from 174c7cb GEODE-8651: MsgReader's readHeader and readMessage should be synchron… (#5665) new 10af7ea GEODE-8136: Move UncheckedUtils to geode-common (#5123) new cde469c GEODE-8540: Create new DistributedBlackboard Rule (#5557) new b2af727 GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666) The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../geode/util/internal}/UncheckedUtils.java | 19 +- .../geode/util/internal/UncheckedUtilsTest.java| 60 .../cache/PartitionedRegionSingleHopDUnitTest.java | 14 +- ...istributedRegionFunctionExecutionDUnitTest.java | 59 +--- ...oningWithColocationAndPersistenceDUnitTest.java | 12 +- .../tcp/ConnectionCloseSSLTLSDUnitTest.java| 238 + .../org/apache/geode/internal/tcp}/server.keystore | Bin .../FunctionExecutionOnLonerRegressionTest.java| 27 +- ...LSocketHostNameVerificationIntegrationTest.java | 4 +- .../internal/net/SSLSocketIntegrationTest.java | 57 +-- .../apache/geode/codeAnalysis/excludedClasses.txt | 1 + .../client/internal/ClientMetadataService.java | 4 +- .../geode/internal/cache/GemFireCacheImpl.java | 49 +-- .../cache/InternalCacheForClientAccess.java| 6 +- .../apache/geode/internal/cache/LocalRegion.java | 7 +- .../util/TypedFunctionService.java}| 20 +- .../tier/sockets/CacheClientProxyFactory.java | 4 +- .../geode/internal/net/ByteBufferSharing.java | 55 +++ .../geode/internal/net/ByteBufferSharingImpl.java | 148 .../geode/internal/net/ByteBufferSharingNoOp.java | 52 +++ .../org/apache/geode/internal/net/NioFilter.java | 69 ++-- .../apache/geode/internal/net/NioPlainEngine.java | 27 +- .../apache/geode/internal/net/NioSslEngine.java| 353 ++- .../org/apache/geode/internal/tcp/Connection.java | 34 +- .../org/apache/geode/internal/tcp/MsgReader.java | 15 +- .../internal/ClusterAlertMessagingTest.java| 6 +- .../internal/net/ByteBufferSharingImplTest.java| 163 + .../geode/internal/net/NioPlainEngineTest.java | 47 ++- .../geode/internal/net/NioSslEngineTest.java | 392 +++-- .../apache/geode/internal/tcp/TCPConduitTest.java | 4 +- .../dunit/internal/DUnitBlackboardDUnitTest.java | 75 ++-- .../DistributedBlackboardDistributedTest.java | 297 .../InternalBlackboard.java => Blackboard.java}| 54 +-- .../apache/geode/test/dunit/DUnitBlackboard.java | 55 +-- .../test/dunit/internal/InternalBlackboard.java| 33 +- .../dunit/internal/InternalBlackboardImpl.java | 59 +++- .../test/dunit/rules/DistributedBlackboard.java| 138 37 files changed, 1930 insertions(+), 727 deletions(-) copy {geode-core/src/main/java/org/apache/geode/internal/cache/util => geode-common/src/main/java/org/apache/geode/util/internal}/UncheckedUtils.java (68%) create mode 100644 geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java create mode 100644 geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java copy {geode-dunit/src/main/resources/org/apache/geode => geode-core/src/distributedTest/resources/org/apache/geode/internal/tcp}/server.keystore (100%) rename geode-core/src/main/java/org/apache/geode/internal/cache/{util/UncheckedUtils.java => execute/util/TypedFunctionService.java} (61%) create mode 100644 geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharing.java create mode 100644 geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingImpl.java create mode 100644 geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingNoOp.java create mode 100644 geode-core/src/test/java/org/apache/geode/internal/net/ByteBufferSharingImplTest.java create mode 100644 geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/rules/tests/DistributedBlackboardDistributedTest.java copy geode-dunit/src/main/java/org/apache/geode/test/dunit/{internal/InternalBlackboard.java => Blackboard.java} (51%) mode change 100755 => 100644 create mode 100644 geode-dunit/src/main/java/org/apache/geode/test/dunit/rules/DistributedBlackboard.java
[geode] 03/03: GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git commit b2af727ce23fd155f3665e3db2ecee6e8f80fba7 Author: Bill Burcham AuthorDate: Thu Oct 29 16:38:25 2020 -0700 GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666) - NioSslEngine.close() proceeds even if readers (or writers) are operating on its ByteBuffers, allowing Connection.close() to close its socket and proceed. - NioSslEngine.close() needed a lock only on the output buffer, so we split what was a single lock into two. Also instead of using synchronized we use a ReentrantLock so we can call tryLock() and time out if needed in NioSslEngine.close(). - Since readers/writers may hold locks on these input/output buffers when NioSslEngine.close() is called a reference count is maintained and the buffers are returned to the pool only when the last user is done. - To manage the locking and reference counting a new AutoCloseable ByteBufferSharing interface is introduced with a trivial implementation: ByteBufferSharingNoOp and a real implementation: ByteBufferSharingImpl. Co-authored-by: Bill Burcham Co-authored-by: Darrel Schneider Co-authored-by: Ernie Burghardt (cherry picked from commit 08e9e9673d0ed0a3d74c6d16e706817cab09) --- .../tcp/ConnectionCloseSSLTLSDUnitTest.java| 238 + .../org/apache/geode/internal/tcp/server.keystore | Bin 0 -> 1256 bytes ...LSocketHostNameVerificationIntegrationTest.java | 4 +- .../internal/net/SSLSocketIntegrationTest.java | 57 +-- .../apache/geode/codeAnalysis/excludedClasses.txt | 1 + .../geode/internal/net/ByteBufferSharing.java | 55 +++ .../geode/internal/net/ByteBufferSharingImpl.java | 148 .../geode/internal/net/ByteBufferSharingNoOp.java | 52 +++ .../org/apache/geode/internal/net/NioFilter.java | 69 ++-- .../apache/geode/internal/net/NioPlainEngine.java | 27 +- .../apache/geode/internal/net/NioSslEngine.java| 353 ++- .../org/apache/geode/internal/tcp/Connection.java | 34 +- .../org/apache/geode/internal/tcp/MsgReader.java | 15 +- .../internal/net/ByteBufferSharingImplTest.java| 163 + .../geode/internal/net/NioPlainEngineTest.java | 47 ++- .../geode/internal/net/NioSslEngineTest.java | 392 +++-- 16 files changed, 1195 insertions(+), 460 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java new file mode 100644 index 000..77fe9bf --- /dev/null +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java @@ -0,0 +1,238 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.apache.geode.internal.tcp; + +import static org.apache.geode.distributed.ConfigurationProperties.CONSERVE_SOCKETS; +import static org.apache.geode.distributed.ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION; +import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS; +import static org.apache.geode.distributed.ConfigurationProperties.NAME; +import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_BUFFER_SIZE; +import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_LEASE_TIME; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_ENABLED_COMPONENTS; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE_PASSWORD; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_PROTOCOLS; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_REQUIRE_AUTHENTICATION; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_TRUSTSTORE; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_TRUSTSTORE_PASSWORD; +import static
[geode] 01/03: GEODE-8136: Move UncheckedUtils to geode-common (#5123)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git commit 10af7ea015ec85ef02b2e972c7a3dd3ec23bcb7f Author: Kirk Lund AuthorDate: Tue May 26 10:24:44 2020 -0700 GEODE-8136: Move UncheckedUtils to geode-common (#5123) Create UncheckedUtilsTest to unit test UncheckedUtils. Extract FunctionExecution methods to new TypedFunctionService in geode-core. (cherry picked from commit 253d667b27423e55601e925f7a20f2fd6f0efc31) --- .../geode/util/internal}/UncheckedUtils.java | 19 --- .../geode/util/internal/UncheckedUtilsTest.java| 60 ++ .../cache/PartitionedRegionSingleHopDUnitTest.java | 14 ++--- ...istributedRegionFunctionExecutionDUnitTest.java | 59 +++-- ...oningWithColocationAndPersistenceDUnitTest.java | 12 ++--- .../FunctionExecutionOnLonerRegressionTest.java| 27 ++ .../client/internal/ClientMetadataService.java | 4 +- .../geode/internal/cache/GemFireCacheImpl.java | 49 -- .../cache/InternalCacheForClientAccess.java| 6 +-- .../apache/geode/internal/cache/LocalRegion.java | 7 ++- .../util/TypedFunctionService.java}| 20 +--- .../tier/sockets/CacheClientProxyFactory.java | 4 +- .../internal/ClusterAlertMessagingTest.java| 6 +-- .../apache/geode/internal/tcp/TCPConduitTest.java | 4 +- 14 files changed, 151 insertions(+), 140 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/util/UncheckedUtils.java b/geode-common/src/main/java/org/apache/geode/util/internal/UncheckedUtils.java similarity index 68% copy from geode-core/src/main/java/org/apache/geode/internal/cache/util/UncheckedUtils.java copy to geode-common/src/main/java/org/apache/geode/util/internal/UncheckedUtils.java index c03e990..61dbd8d 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/util/UncheckedUtils.java +++ b/geode-common/src/main/java/org/apache/geode/util/internal/UncheckedUtils.java @@ -12,18 +12,23 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ -package org.apache.geode.internal.cache.util; - -import org.apache.geode.cache.execute.Execution; +package org.apache.geode.util.internal; +/** + * Utilities for casting and working with unchecked raw types. + */ @SuppressWarnings({"unchecked", "unused"}) public class UncheckedUtils { - public static T cast(Object object) { -return (T) object; + protected UncheckedUtils() { +// do not instantiate } - public static Execution cast(Execution execution) { -return execution; + /** + * Casts an instance of a raw type to a parameterized type. Preference should be given to + * converting all code from using raw types to using parameterized types when possible. + */ + public static T uncheckedCast(Object object) { +return (T) object; } } diff --git a/geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java b/geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java new file mode 100644 index 000..7c282b7 --- /dev/null +++ b/geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java @@ -0,0 +1,60 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ +package org.apache.geode.util.internal; + +import static org.apache.geode.util.internal.UncheckedUtils.uncheckedCast; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.catchThrowable; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Test; + +@SuppressWarnings("unchecked") +public class UncheckedUtilsTest { + + @Test + public void uncheckedCast_rawList_empty() { +List rawList = new ArrayList(); + +List value = uncheckedCast(rawList); + +assertThat(value).isSameAs(rawList); + } + + @Test + public void uncheckedCast_rawList_nonEmpty() { +List rawList = new ArrayList(); +rawList.add("1"); +rawList.add("2"); + +List value =
[geode] branch support/1.13 updated (174c7cb -> b2af727)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a change to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git. from 174c7cb GEODE-8651: MsgReader's readHeader and readMessage should be synchron… (#5665) new 10af7ea GEODE-8136: Move UncheckedUtils to geode-common (#5123) new cde469c GEODE-8540: Create new DistributedBlackboard Rule (#5557) new b2af727 GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666) The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../geode/util/internal}/UncheckedUtils.java | 19 +- .../geode/util/internal/UncheckedUtilsTest.java| 60 .../cache/PartitionedRegionSingleHopDUnitTest.java | 14 +- ...istributedRegionFunctionExecutionDUnitTest.java | 59 +--- ...oningWithColocationAndPersistenceDUnitTest.java | 12 +- .../tcp/ConnectionCloseSSLTLSDUnitTest.java| 238 + .../org/apache/geode/internal/tcp}/server.keystore | Bin .../FunctionExecutionOnLonerRegressionTest.java| 27 +- ...LSocketHostNameVerificationIntegrationTest.java | 4 +- .../internal/net/SSLSocketIntegrationTest.java | 57 +-- .../apache/geode/codeAnalysis/excludedClasses.txt | 1 + .../client/internal/ClientMetadataService.java | 4 +- .../geode/internal/cache/GemFireCacheImpl.java | 49 +-- .../cache/InternalCacheForClientAccess.java| 6 +- .../apache/geode/internal/cache/LocalRegion.java | 7 +- .../util/TypedFunctionService.java}| 20 +- .../tier/sockets/CacheClientProxyFactory.java | 4 +- .../geode/internal/net/ByteBufferSharing.java | 55 +++ .../geode/internal/net/ByteBufferSharingImpl.java | 148 .../geode/internal/net/ByteBufferSharingNoOp.java | 52 +++ .../org/apache/geode/internal/net/NioFilter.java | 69 ++-- .../apache/geode/internal/net/NioPlainEngine.java | 27 +- .../apache/geode/internal/net/NioSslEngine.java| 353 ++- .../org/apache/geode/internal/tcp/Connection.java | 34 +- .../org/apache/geode/internal/tcp/MsgReader.java | 15 +- .../internal/ClusterAlertMessagingTest.java| 6 +- .../internal/net/ByteBufferSharingImplTest.java| 163 + .../geode/internal/net/NioPlainEngineTest.java | 47 ++- .../geode/internal/net/NioSslEngineTest.java | 392 +++-- .../apache/geode/internal/tcp/TCPConduitTest.java | 4 +- .../dunit/internal/DUnitBlackboardDUnitTest.java | 75 ++-- .../DistributedBlackboardDistributedTest.java | 297 .../InternalBlackboard.java => Blackboard.java}| 54 +-- .../apache/geode/test/dunit/DUnitBlackboard.java | 55 +-- .../test/dunit/internal/InternalBlackboard.java| 33 +- .../dunit/internal/InternalBlackboardImpl.java | 59 +++- .../test/dunit/rules/DistributedBlackboard.java| 138 37 files changed, 1930 insertions(+), 727 deletions(-) copy {geode-core/src/main/java/org/apache/geode/internal/cache/util => geode-common/src/main/java/org/apache/geode/util/internal}/UncheckedUtils.java (68%) create mode 100644 geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java create mode 100644 geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java copy {geode-dunit/src/main/resources/org/apache/geode => geode-core/src/distributedTest/resources/org/apache/geode/internal/tcp}/server.keystore (100%) rename geode-core/src/main/java/org/apache/geode/internal/cache/{util/UncheckedUtils.java => execute/util/TypedFunctionService.java} (61%) create mode 100644 geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharing.java create mode 100644 geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingImpl.java create mode 100644 geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingNoOp.java create mode 100644 geode-core/src/test/java/org/apache/geode/internal/net/ByteBufferSharingImplTest.java create mode 100644 geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/rules/tests/DistributedBlackboardDistributedTest.java copy geode-dunit/src/main/java/org/apache/geode/test/dunit/{internal/InternalBlackboard.java => Blackboard.java} (51%) mode change 100755 => 100644 create mode 100644 geode-dunit/src/main/java/org/apache/geode/test/dunit/rules/DistributedBlackboard.java
[geode] 03/03: GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git commit b2af727ce23fd155f3665e3db2ecee6e8f80fba7 Author: Bill Burcham AuthorDate: Thu Oct 29 16:38:25 2020 -0700 GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666) - NioSslEngine.close() proceeds even if readers (or writers) are operating on its ByteBuffers, allowing Connection.close() to close its socket and proceed. - NioSslEngine.close() needed a lock only on the output buffer, so we split what was a single lock into two. Also instead of using synchronized we use a ReentrantLock so we can call tryLock() and time out if needed in NioSslEngine.close(). - Since readers/writers may hold locks on these input/output buffers when NioSslEngine.close() is called a reference count is maintained and the buffers are returned to the pool only when the last user is done. - To manage the locking and reference counting a new AutoCloseable ByteBufferSharing interface is introduced with a trivial implementation: ByteBufferSharingNoOp and a real implementation: ByteBufferSharingImpl. Co-authored-by: Bill Burcham Co-authored-by: Darrel Schneider Co-authored-by: Ernie Burghardt (cherry picked from commit 08e9e9673d0ed0a3d74c6d16e706817cab09) --- .../tcp/ConnectionCloseSSLTLSDUnitTest.java| 238 + .../org/apache/geode/internal/tcp/server.keystore | Bin 0 -> 1256 bytes ...LSocketHostNameVerificationIntegrationTest.java | 4 +- .../internal/net/SSLSocketIntegrationTest.java | 57 +-- .../apache/geode/codeAnalysis/excludedClasses.txt | 1 + .../geode/internal/net/ByteBufferSharing.java | 55 +++ .../geode/internal/net/ByteBufferSharingImpl.java | 148 .../geode/internal/net/ByteBufferSharingNoOp.java | 52 +++ .../org/apache/geode/internal/net/NioFilter.java | 69 ++-- .../apache/geode/internal/net/NioPlainEngine.java | 27 +- .../apache/geode/internal/net/NioSslEngine.java| 353 ++- .../org/apache/geode/internal/tcp/Connection.java | 34 +- .../org/apache/geode/internal/tcp/MsgReader.java | 15 +- .../internal/net/ByteBufferSharingImplTest.java| 163 + .../geode/internal/net/NioPlainEngineTest.java | 47 ++- .../geode/internal/net/NioSslEngineTest.java | 392 +++-- 16 files changed, 1195 insertions(+), 460 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java new file mode 100644 index 000..77fe9bf --- /dev/null +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java @@ -0,0 +1,238 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.apache.geode.internal.tcp; + +import static org.apache.geode.distributed.ConfigurationProperties.CONSERVE_SOCKETS; +import static org.apache.geode.distributed.ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION; +import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS; +import static org.apache.geode.distributed.ConfigurationProperties.NAME; +import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_BUFFER_SIZE; +import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_LEASE_TIME; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_ENABLED_COMPONENTS; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE_PASSWORD; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_PROTOCOLS; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_REQUIRE_AUTHENTICATION; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_TRUSTSTORE; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_TRUSTSTORE_PASSWORD; +import static
[geode] 02/03: GEODE-8540: Create new DistributedBlackboard Rule (#5557)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git commit cde469c6b6955a334e6bbf22accfc0735f0c70f4 Author: Kirk Lund AuthorDate: Wed Sep 30 09:39:30 2020 -0700 GEODE-8540: Create new DistributedBlackboard Rule (#5557) Package up DUnitBlackboard as a JUnit Rule named DistributedBlackboard. (cherry picked from commit 26cb822f2ee467545dd708ecc867cebbd2473c70) --- .../dunit/internal/DUnitBlackboardDUnitTest.java | 75 +++--- .../DistributedBlackboardDistributedTest.java | 297 + .../InternalBlackboard.java => Blackboard.java}| 54 ++-- .../apache/geode/test/dunit/DUnitBlackboard.java | 55 ++-- .../test/dunit/internal/InternalBlackboard.java| 33 ++- .../dunit/internal/InternalBlackboardImpl.java | 59 ++-- .../test/dunit/rules/DistributedBlackboard.java| 138 ++ 7 files changed, 584 insertions(+), 127 deletions(-) diff --git a/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java b/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java index ae78247..5e151d7 100755 --- a/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java +++ b/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java @@ -14,83 +14,70 @@ */ package org.apache.geode.test.dunit.internal; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static java.util.concurrent.TimeUnit.SECONDS; +import static org.apache.geode.test.dunit.VM.getVM; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.catchThrowable; -import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import org.junit.Test; -import org.apache.geode.test.dunit.Host; import org.apache.geode.test.dunit.VM; - +@SuppressWarnings("serial") public class DUnitBlackboardDUnitTest extends JUnit4DistributedTestCase { + @Test - public void canPassDataBetweenVMs() throws Exception { + public void canPassDataBetweenVMs() { final String MBOX = "myMailbox"; -VM vm0 = Host.getHost(0).getVM(0); -VM vm1 = Host.getHost(0).getVM(1); +VM vm0 = getVM(0); +VM vm1 = getVM(1); vm0.invoke("put data in mailbox", () -> getBlackboard().setMailbox(MBOX, "testing")); -String result = (String) vm1.invoke("get data from mailbox", () -> { - return getBlackboard().getMailbox(MBOX); -}); +String result = vm1.invoke("get data from mailbox", () -> getBlackboard().getMailbox(MBOX)); -assertEquals("testing", result); +assertThat(result).isEqualTo("testing"); } @Test - public void canSignalAnotherVM() throws Exception { + public void canSignalAnotherVM() { final String GATE = "myGate"; -VM vm0 = Host.getHost(0).getVM(0); -VM vm1 = Host.getHost(0).getVM(1); +VM vm0 = getVM(0); +VM vm1 = getVM(1); vm1.invoke("wait on gate not yet signalled", () -> { - assertFalse(getBlackboard().isGateSignaled(GATE)); - try { -getBlackboard().waitForGate(GATE, 1, TimeUnit.SECONDS); - } catch (TimeoutException e) { -// expected -return; - } catch (InterruptedException e) { -fail("unexpected interrupt"); - } - fail("unexpected success"); + assertThat(getBlackboard().isGateSignaled(GATE)).isFalse(); + + Throwable thrown = catchThrowable(() -> { +getBlackboard().waitForGate(GATE, 1, SECONDS); + }); + + assertThat(thrown).isInstanceOf(TimeoutException.class); }); vm0.invoke("signal gate", () -> getBlackboard().signalGate(GATE)); -vm1.invoke("wait on gate not yet signalled", () -> { - try { -getBlackboard().waitForGate(GATE, 1, TimeUnit.SECONDS); - } catch (TimeoutException e) { -fail("unexpected timeout"); - } catch (InterruptedException e) { -fail("unexpected interrupt"); - } - // success expected -}); +vm1.invoke("wait on gate not yet signalled", +() -> getBlackboard().waitForGate(GATE, 1, SECONDS)); } @Test - public void initBlackboardClearsEverything() throws Exception { + public void initBlackboardClearsEverything() { for (int i = 0; i < 100; i++) { getBlackboard().setMailbox("MBOX" + i, "value" + i); - assertEquals("value" + i, getBlackboard().getMailbox("MBOX" + i)); + assertThat((Object) getBlackboard().getMailbox("MBOX" + i)).isEqualTo("value" + i); + getBlackboard().signalGate("GATE" + i); - assertTrue(getBlackboard().isGateSignaled("GATE" + i)); +
[geode] 01/03: GEODE-8136: Move UncheckedUtils to geode-common (#5123)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git commit 10af7ea015ec85ef02b2e972c7a3dd3ec23bcb7f Author: Kirk Lund AuthorDate: Tue May 26 10:24:44 2020 -0700 GEODE-8136: Move UncheckedUtils to geode-common (#5123) Create UncheckedUtilsTest to unit test UncheckedUtils. Extract FunctionExecution methods to new TypedFunctionService in geode-core. (cherry picked from commit 253d667b27423e55601e925f7a20f2fd6f0efc31) --- .../geode/util/internal}/UncheckedUtils.java | 19 --- .../geode/util/internal/UncheckedUtilsTest.java| 60 ++ .../cache/PartitionedRegionSingleHopDUnitTest.java | 14 ++--- ...istributedRegionFunctionExecutionDUnitTest.java | 59 +++-- ...oningWithColocationAndPersistenceDUnitTest.java | 12 ++--- .../FunctionExecutionOnLonerRegressionTest.java| 27 ++ .../client/internal/ClientMetadataService.java | 4 +- .../geode/internal/cache/GemFireCacheImpl.java | 49 -- .../cache/InternalCacheForClientAccess.java| 6 +-- .../apache/geode/internal/cache/LocalRegion.java | 7 ++- .../util/TypedFunctionService.java}| 20 +--- .../tier/sockets/CacheClientProxyFactory.java | 4 +- .../internal/ClusterAlertMessagingTest.java| 6 +-- .../apache/geode/internal/tcp/TCPConduitTest.java | 4 +- 14 files changed, 151 insertions(+), 140 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/util/UncheckedUtils.java b/geode-common/src/main/java/org/apache/geode/util/internal/UncheckedUtils.java similarity index 68% copy from geode-core/src/main/java/org/apache/geode/internal/cache/util/UncheckedUtils.java copy to geode-common/src/main/java/org/apache/geode/util/internal/UncheckedUtils.java index c03e990..61dbd8d 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/util/UncheckedUtils.java +++ b/geode-common/src/main/java/org/apache/geode/util/internal/UncheckedUtils.java @@ -12,18 +12,23 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ -package org.apache.geode.internal.cache.util; - -import org.apache.geode.cache.execute.Execution; +package org.apache.geode.util.internal; +/** + * Utilities for casting and working with unchecked raw types. + */ @SuppressWarnings({"unchecked", "unused"}) public class UncheckedUtils { - public static T cast(Object object) { -return (T) object; + protected UncheckedUtils() { +// do not instantiate } - public static Execution cast(Execution execution) { -return execution; + /** + * Casts an instance of a raw type to a parameterized type. Preference should be given to + * converting all code from using raw types to using parameterized types when possible. + */ + public static T uncheckedCast(Object object) { +return (T) object; } } diff --git a/geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java b/geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java new file mode 100644 index 000..7c282b7 --- /dev/null +++ b/geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java @@ -0,0 +1,60 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ +package org.apache.geode.util.internal; + +import static org.apache.geode.util.internal.UncheckedUtils.uncheckedCast; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.catchThrowable; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Test; + +@SuppressWarnings("unchecked") +public class UncheckedUtilsTest { + + @Test + public void uncheckedCast_rawList_empty() { +List rawList = new ArrayList(); + +List value = uncheckedCast(rawList); + +assertThat(value).isSameAs(rawList); + } + + @Test + public void uncheckedCast_rawList_nonEmpty() { +List rawList = new ArrayList(); +rawList.add("1"); +rawList.add("2"); + +List value =
[geode] branch develop updated (a00f18d -> 4024509)
This is an automated email from the ASF dual-hosted git repository. jinmeiliao pushed a change to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git. from a00f18d GEODE-8659: Consolidating locator-wait-time-tests add 4024509 GEODE-8570: deprecate cluster-configuration-dir property (#5684) No new revisions were added by this update. Summary of changes: .../configuration/ClusterConfigStartMemberDUnitTest.java| 2 -- .../distributed/LocatorLauncherIntegrationTestCase.java | 2 -- .../apache/geode/distributed/ConfigurationProperties.java | 7 +++ .../apache/geode/management/internal/i18n/CliStrings.java | 3 ++- geode-docs/reference/topics/gemfire_properties.html.md.erb | 2 +- .../commands/DestroySecondJndiBindingCommandDUnitTest.java | 13 + .../internal/cli/commands/StartLocatorCommand.java | 2 -- 7 files changed, 11 insertions(+), 20 deletions(-)
[geode] branch develop updated (a00f18d -> 4024509)
This is an automated email from the ASF dual-hosted git repository. jinmeiliao pushed a change to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git. from a00f18d GEODE-8659: Consolidating locator-wait-time-tests add 4024509 GEODE-8570: deprecate cluster-configuration-dir property (#5684) No new revisions were added by this update. Summary of changes: .../configuration/ClusterConfigStartMemberDUnitTest.java| 2 -- .../distributed/LocatorLauncherIntegrationTestCase.java | 2 -- .../apache/geode/distributed/ConfigurationProperties.java | 7 +++ .../apache/geode/management/internal/i18n/CliStrings.java | 3 ++- geode-docs/reference/topics/gemfire_properties.html.md.erb | 2 +- .../commands/DestroySecondJndiBindingCommandDUnitTest.java | 13 + .../internal/cli/commands/StartLocatorCommand.java | 2 -- 7 files changed, 11 insertions(+), 20 deletions(-)
[geode] branch backport-1-12-GEODE-8652-and-friends created (now 1395c6a)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a change to branch backport-1-12-GEODE-8652-and-friends in repository https://gitbox.apache.org/repos/asf/geode.git. at 1395c6a GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666) This branch includes the following new commits: new 1395c6a GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666) The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
[geode] 01/01: GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch backport-1-12-GEODE-8652-and-friends in repository https://gitbox.apache.org/repos/asf/geode.git commit 1395c6afe4d943bae87665f580501e5df64de111 Author: Bill Burcham AuthorDate: Thu Oct 29 16:38:25 2020 -0700 GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666) - NioSslEngine.close() proceeds even if readers (or writers) are operating on its ByteBuffers, allowing Connection.close() to close its socket and proceed. - NioSslEngine.close() needed a lock only on the output buffer, so we split what was a single lock into two. Also instead of using synchronized we use a ReentrantLock so we can call tryLock() and time out if needed in NioSslEngine.close(). - Since readers/writers may hold locks on these input/output buffers when NioSslEngine.close() is called a reference count is maintained and the buffers are returned to the pool only when the last user is done. - To manage the locking and reference counting a new AutoCloseable ByteBufferSharing interface is introduced with a trivial implementation: ByteBufferSharingNoOp and a real implementation: ByteBufferSharingImpl. Co-authored-by: Bill Burcham Co-authored-by: Darrel Schneider Co-authored-by: Ernie Burghardt (cherry picked from commit 08e9e9673d0ed0a3d74c6d16e706817cab09) --- .../tcp/ConnectionCloseSSLTLSDUnitTest.java| 235 .../org/apache/geode/internal/tcp/server.keystore | Bin 0 -> 1256 bytes ...LSocketHostNameVerificationIntegrationTest.java | 4 +- .../internal/net/SSLSocketIntegrationTest.java | 57 +-- .../apache/geode/codeAnalysis/excludedClasses.txt | 1 + .../geode/internal/net/ByteBufferSharing.java | 55 +++ .../geode/internal/net/ByteBufferSharingImpl.java | 148 .../geode/internal/net/ByteBufferSharingNoOp.java | 52 +++ .../org/apache/geode/internal/net/NioFilter.java | 69 ++-- .../apache/geode/internal/net/NioPlainEngine.java | 27 +- .../apache/geode/internal/net/NioSslEngine.java| 357 +- .../org/apache/geode/internal/tcp/Connection.java | 34 +- .../org/apache/geode/internal/tcp/MsgReader.java | 15 +- .../internal/net/ByteBufferSharingImplTest.java| 163 + .../geode/internal/net/NioPlainEngineTest.java | 47 ++- .../geode/internal/net/NioSslEngineTest.java | 397 +++-- 16 files changed, 1199 insertions(+), 462 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java new file mode 100644 index 000..586cd53 --- /dev/null +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java @@ -0,0 +1,235 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.apache.geode.internal.tcp; + +import static java.util.concurrent.TimeUnit.MINUTES; +import static org.apache.geode.distributed.ConfigurationProperties.CONSERVE_SOCKETS; +import static org.apache.geode.distributed.ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION; +import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS; +import static org.apache.geode.distributed.ConfigurationProperties.NAME; +import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_BUFFER_SIZE; +import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_LEASE_TIME; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_ENABLED_COMPONENTS; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE_PASSWORD; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_PROTOCOLS; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_REQUIRE_AUTHENTICATION; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_TRUSTSTORE; +import static
[geode] branch develop updated: GEODE-8659: Consolidating locator-wait-time-tests
This is an automated email from the ASF dual-hosted git repository. upthewaterspout pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new a00f18d GEODE-8659: Consolidating locator-wait-time-tests a00f18d is described below commit a00f18de72ebc282e32fb2f67049fd21da58cfa6 Author: Dan Smith AuthorDate: Fri Oct 30 10:01:28 2020 -0700 GEODE-8659: Consolidating locator-wait-time-tests We had two different tests of this functionality that were testing almost the same thing. The first test had a slightly odd configuration - only one of the locators knew about the other. Combining these into a single test that locators wait for locator-wait-time and stop waiting when all locators are found. --- .../membership/gms/MembershipIntegrationTest.java | 100 - 1 file changed, 18 insertions(+), 82 deletions(-) diff --git a/geode-membership/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/MembershipIntegrationTest.java b/geode-membership/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/MembershipIntegrationTest.java index 4ed9289..3420d36 100644 --- a/geode-membership/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/MembershipIntegrationTest.java +++ b/geode-membership/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/MembershipIntegrationTest.java @@ -187,41 +187,26 @@ public class MembershipIntegrationTest { } @Test - public void secondMembershipPausesForLocatorWaitTime() - throws IOException, MemberStartupException, InterruptedException { + public void locatorWaitsForLocatorWaitTimeUntilAllLocatorsContacted() + throws InterruptedException, TimeoutException, ExecutionException { -/* - * Start a locator for the coordinator (membership) so we have a port for it. - * - * Its locator-wait-time is set to 0 so it eventually (soon after membership is started) forms a - * distributed system and becomes a coordinator. - */ - -final MembershipLocator coordinatorLocator = createLocator(0); -coordinatorLocator.start(); -final int coordinatorLocatorPort = coordinatorLocator.getPort(); +final Supplier executorServiceSupplier = +() -> LoggingExecutors.newCachedThreadPool("membership", false); -final Membership coordinatorMembership = -createMembership(coordinatorLocator, coordinatorLocatorPort); +int[] locatorPorts = AvailablePortHelper.getRandomAvailableTCPPorts(2); -/* - * We have not even started the membership yet — connection attempts will certainly fail until - * we do. This is a bit like the locator (host) not being present in DNS (yet). - */ +int locatorWaitTime = (int) Duration.ofMinutes(5).getSeconds(); +final MembershipConfig config = +createMembershipConfig(true, locatorWaitTime, locatorPorts[0], locatorPorts[1]); /* - * Start a second locator and membership trying to join via the coordinator (membership) that - * hasn't yet started behind the port. + * Start a locator trying to contact the locator that hasn't started it's port * * Set its locator-wait-time so it'll not become a coordinator right away, allowing time for the * other member to start and become a coordinator. */ - -final MembershipLocator lateJoiningLocator = createLocator(0); -lateJoiningLocator.start(); -final int lateJoiningLocatorPort = lateJoiningLocator.getPort(); - -final int[] locatorPorts = new int[] {coordinatorLocatorPort, lateJoiningLocatorPort}; +CompletableFuture> createMembership0 = +launchLocator(executorServiceSupplier, locatorPorts[0], config); // minimum duration a locator waits to become the coordinator, regardless of locatorWaitTime final Duration minimumJoinWaitTime = Duration @@ -231,27 +216,6 @@ public class MembershipIntegrationTest { .multipliedBy(getMinimumRetriesBeforeBecomingCoordinator(locatorPorts.length)); /* - * By setting locatorWaitTime to 10x the minimumJoinWaitTime, we are trying to make sure the - * locatorWaitTime is sufficiently larger than the minimum so we can reliably detect whether - * the lateJoiningMembership is waiting for the full locatorWaitTime and not just the minimum - * wait time. - */ -final int locatorWaitTime = (int) (10 * minimumJoinWaitTime.getSeconds()); - -final MembershipConfig lateJoiningMembershipConfig = -createMembershipConfig(true, locatorWaitTime, locatorPorts); -final Membership lateJoiningMembership = -createMembership(lateJoiningMembershipConfig, lateJoiningLocator); - -CompletableFuture lateJoiningMembershipStartup = executorServiceRule.runAsync(() -> { - try { -start(lateJoiningMembership); -
[geode] branch backport-1-13-GEODE-8652-and-friends created (now 0906b08)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a change to branch backport-1-13-GEODE-8652-and-friends in repository https://gitbox.apache.org/repos/asf/geode.git. at 0906b08 GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666) No new revisions were added by this update.
[geode] 01/03: GEODE-8136: Move UncheckedUtils to geode-common (#5123)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch backport-1-13-GEODE-8652-and-friends in repository https://gitbox.apache.org/repos/asf/geode.git commit ca51909fe78be707376d9d411d709a4cea3bbdb2 Author: Kirk Lund AuthorDate: Tue May 26 10:24:44 2020 -0700 GEODE-8136: Move UncheckedUtils to geode-common (#5123) Create UncheckedUtilsTest to unit test UncheckedUtils. Extract FunctionExecution methods to new TypedFunctionService in geode-core. (cherry picked from commit 253d667b27423e55601e925f7a20f2fd6f0efc31) --- .../geode/util/internal}/UncheckedUtils.java | 19 --- .../geode/util/internal/UncheckedUtilsTest.java| 60 ++ .../cache/PartitionedRegionSingleHopDUnitTest.java | 14 ++--- ...istributedRegionFunctionExecutionDUnitTest.java | 59 +++-- ...oningWithColocationAndPersistenceDUnitTest.java | 12 ++--- .../FunctionExecutionOnLonerRegressionTest.java| 27 ++ .../client/internal/ClientMetadataService.java | 4 +- .../geode/internal/cache/GemFireCacheImpl.java | 49 -- .../cache/InternalCacheForClientAccess.java| 6 +-- .../apache/geode/internal/cache/LocalRegion.java | 7 ++- .../util/TypedFunctionService.java}| 20 +--- .../tier/sockets/CacheClientProxyFactory.java | 4 +- .../internal/ClusterAlertMessagingTest.java| 6 +-- .../apache/geode/internal/tcp/TCPConduitTest.java | 4 +- 14 files changed, 151 insertions(+), 140 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/util/UncheckedUtils.java b/geode-common/src/main/java/org/apache/geode/util/internal/UncheckedUtils.java similarity index 68% copy from geode-core/src/main/java/org/apache/geode/internal/cache/util/UncheckedUtils.java copy to geode-common/src/main/java/org/apache/geode/util/internal/UncheckedUtils.java index c03e990..61dbd8d 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/util/UncheckedUtils.java +++ b/geode-common/src/main/java/org/apache/geode/util/internal/UncheckedUtils.java @@ -12,18 +12,23 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ -package org.apache.geode.internal.cache.util; - -import org.apache.geode.cache.execute.Execution; +package org.apache.geode.util.internal; +/** + * Utilities for casting and working with unchecked raw types. + */ @SuppressWarnings({"unchecked", "unused"}) public class UncheckedUtils { - public static T cast(Object object) { -return (T) object; + protected UncheckedUtils() { +// do not instantiate } - public static Execution cast(Execution execution) { -return execution; + /** + * Casts an instance of a raw type to a parameterized type. Preference should be given to + * converting all code from using raw types to using parameterized types when possible. + */ + public static T uncheckedCast(Object object) { +return (T) object; } } diff --git a/geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java b/geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java new file mode 100644 index 000..7c282b7 --- /dev/null +++ b/geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java @@ -0,0 +1,60 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ +package org.apache.geode.util.internal; + +import static org.apache.geode.util.internal.UncheckedUtils.uncheckedCast; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.catchThrowable; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Test; + +@SuppressWarnings("unchecked") +public class UncheckedUtilsTest { + + @Test + public void uncheckedCast_rawList_empty() { +List rawList = new ArrayList(); + +List value = uncheckedCast(rawList); + +assertThat(value).isSameAs(rawList); + } + + @Test + public void uncheckedCast_rawList_nonEmpty() { +List rawList = new ArrayList(); +rawList.add("1"); +rawList.add("2"); + +List
[geode] branch backport-1-13-GEODE-8652-and-friends created (now 0906b08)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a change to branch backport-1-13-GEODE-8652-and-friends in repository https://gitbox.apache.org/repos/asf/geode.git. at 0906b08 GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666) This branch includes the following new commits: new ca51909 GEODE-8136: Move UncheckedUtils to geode-common (#5123) new 9a066e6 GEODE-8540: Create new DistributedBlackboard Rule (#5557) new 0906b08 GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666) The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
[geode] 02/03: GEODE-8540: Create new DistributedBlackboard Rule (#5557)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch backport-1-13-GEODE-8652-and-friends in repository https://gitbox.apache.org/repos/asf/geode.git commit 9a066e64b1722f914994fecb454a2f67f2a46148 Author: Kirk Lund AuthorDate: Wed Sep 30 09:39:30 2020 -0700 GEODE-8540: Create new DistributedBlackboard Rule (#5557) Package up DUnitBlackboard as a JUnit Rule named DistributedBlackboard. (cherry picked from commit 26cb822f2ee467545dd708ecc867cebbd2473c70) --- .../dunit/internal/DUnitBlackboardDUnitTest.java | 75 +++--- .../DistributedBlackboardDistributedTest.java | 297 + .../InternalBlackboard.java => Blackboard.java}| 54 ++-- .../apache/geode/test/dunit/DUnitBlackboard.java | 55 ++-- .../test/dunit/internal/InternalBlackboard.java| 33 ++- .../dunit/internal/InternalBlackboardImpl.java | 59 ++-- .../test/dunit/rules/DistributedBlackboard.java| 138 ++ 7 files changed, 584 insertions(+), 127 deletions(-) diff --git a/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java b/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java index ae78247..5e151d7 100755 --- a/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java +++ b/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java @@ -14,83 +14,70 @@ */ package org.apache.geode.test.dunit.internal; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static java.util.concurrent.TimeUnit.SECONDS; +import static org.apache.geode.test.dunit.VM.getVM; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.catchThrowable; -import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import org.junit.Test; -import org.apache.geode.test.dunit.Host; import org.apache.geode.test.dunit.VM; - +@SuppressWarnings("serial") public class DUnitBlackboardDUnitTest extends JUnit4DistributedTestCase { + @Test - public void canPassDataBetweenVMs() throws Exception { + public void canPassDataBetweenVMs() { final String MBOX = "myMailbox"; -VM vm0 = Host.getHost(0).getVM(0); -VM vm1 = Host.getHost(0).getVM(1); +VM vm0 = getVM(0); +VM vm1 = getVM(1); vm0.invoke("put data in mailbox", () -> getBlackboard().setMailbox(MBOX, "testing")); -String result = (String) vm1.invoke("get data from mailbox", () -> { - return getBlackboard().getMailbox(MBOX); -}); +String result = vm1.invoke("get data from mailbox", () -> getBlackboard().getMailbox(MBOX)); -assertEquals("testing", result); +assertThat(result).isEqualTo("testing"); } @Test - public void canSignalAnotherVM() throws Exception { + public void canSignalAnotherVM() { final String GATE = "myGate"; -VM vm0 = Host.getHost(0).getVM(0); -VM vm1 = Host.getHost(0).getVM(1); +VM vm0 = getVM(0); +VM vm1 = getVM(1); vm1.invoke("wait on gate not yet signalled", () -> { - assertFalse(getBlackboard().isGateSignaled(GATE)); - try { -getBlackboard().waitForGate(GATE, 1, TimeUnit.SECONDS); - } catch (TimeoutException e) { -// expected -return; - } catch (InterruptedException e) { -fail("unexpected interrupt"); - } - fail("unexpected success"); + assertThat(getBlackboard().isGateSignaled(GATE)).isFalse(); + + Throwable thrown = catchThrowable(() -> { +getBlackboard().waitForGate(GATE, 1, SECONDS); + }); + + assertThat(thrown).isInstanceOf(TimeoutException.class); }); vm0.invoke("signal gate", () -> getBlackboard().signalGate(GATE)); -vm1.invoke("wait on gate not yet signalled", () -> { - try { -getBlackboard().waitForGate(GATE, 1, TimeUnit.SECONDS); - } catch (TimeoutException e) { -fail("unexpected timeout"); - } catch (InterruptedException e) { -fail("unexpected interrupt"); - } - // success expected -}); +vm1.invoke("wait on gate not yet signalled", +() -> getBlackboard().waitForGate(GATE, 1, SECONDS)); } @Test - public void initBlackboardClearsEverything() throws Exception { + public void initBlackboardClearsEverything() { for (int i = 0; i < 100; i++) { getBlackboard().setMailbox("MBOX" + i, "value" + i); - assertEquals("value" + i, getBlackboard().getMailbox("MBOX" + i)); + assertThat((Object) getBlackboard().getMailbox("MBOX" + i)).isEqualTo("value" + i); + getBlackboard().signalGate("GATE" + i); -
[geode] 03/03: GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch backport-1-13-GEODE-8652-and-friends in repository https://gitbox.apache.org/repos/asf/geode.git commit 0906b08f8f77d5e22d4fd155205129c864a3a85a Author: Bill Burcham AuthorDate: Thu Oct 29 16:38:25 2020 -0700 GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666) - NioSslEngine.close() proceeds even if readers (or writers) are operating on its ByteBuffers, allowing Connection.close() to close its socket and proceed. - NioSslEngine.close() needed a lock only on the output buffer, so we split what was a single lock into two. Also instead of using synchronized we use a ReentrantLock so we can call tryLock() and time out if needed in NioSslEngine.close(). - Since readers/writers may hold locks on these input/output buffers when NioSslEngine.close() is called a reference count is maintained and the buffers are returned to the pool only when the last user is done. - To manage the locking and reference counting a new AutoCloseable ByteBufferSharing interface is introduced with a trivial implementation: ByteBufferSharingNoOp and a real implementation: ByteBufferSharingImpl. Co-authored-by: Bill Burcham Co-authored-by: Darrel Schneider Co-authored-by: Ernie Burghardt (cherry picked from commit 08e9e9673d0ed0a3d74c6d16e706817cab09) --- .../tcp/ConnectionCloseSSLTLSDUnitTest.java| 238 + .../org/apache/geode/internal/tcp/server.keystore | Bin 0 -> 1256 bytes ...LSocketHostNameVerificationIntegrationTest.java | 4 +- .../internal/net/SSLSocketIntegrationTest.java | 57 +-- .../apache/geode/codeAnalysis/excludedClasses.txt | 1 + .../geode/internal/net/ByteBufferSharing.java | 55 +++ .../geode/internal/net/ByteBufferSharingImpl.java | 148 .../geode/internal/net/ByteBufferSharingNoOp.java | 52 +++ .../org/apache/geode/internal/net/NioFilter.java | 69 ++-- .../apache/geode/internal/net/NioPlainEngine.java | 27 +- .../apache/geode/internal/net/NioSslEngine.java| 353 ++- .../org/apache/geode/internal/tcp/Connection.java | 34 +- .../org/apache/geode/internal/tcp/MsgReader.java | 15 +- .../internal/net/ByteBufferSharingImplTest.java| 163 + .../geode/internal/net/NioPlainEngineTest.java | 47 ++- .../geode/internal/net/NioSslEngineTest.java | 392 +++-- 16 files changed, 1195 insertions(+), 460 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java new file mode 100644 index 000..77fe9bf --- /dev/null +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java @@ -0,0 +1,238 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.apache.geode.internal.tcp; + +import static org.apache.geode.distributed.ConfigurationProperties.CONSERVE_SOCKETS; +import static org.apache.geode.distributed.ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION; +import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS; +import static org.apache.geode.distributed.ConfigurationProperties.NAME; +import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_BUFFER_SIZE; +import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_LEASE_TIME; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_ENABLED_COMPONENTS; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE_PASSWORD; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_PROTOCOLS; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_REQUIRE_AUTHENTICATION; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_TRUSTSTORE; +import static
[geode] 03/03: GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch backport-1-13-GEODE-8652-and-friends in repository https://gitbox.apache.org/repos/asf/geode.git commit 0906b08f8f77d5e22d4fd155205129c864a3a85a Author: Bill Burcham AuthorDate: Thu Oct 29 16:38:25 2020 -0700 GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666) - NioSslEngine.close() proceeds even if readers (or writers) are operating on its ByteBuffers, allowing Connection.close() to close its socket and proceed. - NioSslEngine.close() needed a lock only on the output buffer, so we split what was a single lock into two. Also instead of using synchronized we use a ReentrantLock so we can call tryLock() and time out if needed in NioSslEngine.close(). - Since readers/writers may hold locks on these input/output buffers when NioSslEngine.close() is called a reference count is maintained and the buffers are returned to the pool only when the last user is done. - To manage the locking and reference counting a new AutoCloseable ByteBufferSharing interface is introduced with a trivial implementation: ByteBufferSharingNoOp and a real implementation: ByteBufferSharingImpl. Co-authored-by: Bill Burcham Co-authored-by: Darrel Schneider Co-authored-by: Ernie Burghardt (cherry picked from commit 08e9e9673d0ed0a3d74c6d16e706817cab09) --- .../tcp/ConnectionCloseSSLTLSDUnitTest.java| 238 + .../org/apache/geode/internal/tcp/server.keystore | Bin 0 -> 1256 bytes ...LSocketHostNameVerificationIntegrationTest.java | 4 +- .../internal/net/SSLSocketIntegrationTest.java | 57 +-- .../apache/geode/codeAnalysis/excludedClasses.txt | 1 + .../geode/internal/net/ByteBufferSharing.java | 55 +++ .../geode/internal/net/ByteBufferSharingImpl.java | 148 .../geode/internal/net/ByteBufferSharingNoOp.java | 52 +++ .../org/apache/geode/internal/net/NioFilter.java | 69 ++-- .../apache/geode/internal/net/NioPlainEngine.java | 27 +- .../apache/geode/internal/net/NioSslEngine.java| 353 ++- .../org/apache/geode/internal/tcp/Connection.java | 34 +- .../org/apache/geode/internal/tcp/MsgReader.java | 15 +- .../internal/net/ByteBufferSharingImplTest.java| 163 + .../geode/internal/net/NioPlainEngineTest.java | 47 ++- .../geode/internal/net/NioSslEngineTest.java | 392 +++-- 16 files changed, 1195 insertions(+), 460 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java new file mode 100644 index 000..77fe9bf --- /dev/null +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java @@ -0,0 +1,238 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.apache.geode.internal.tcp; + +import static org.apache.geode.distributed.ConfigurationProperties.CONSERVE_SOCKETS; +import static org.apache.geode.distributed.ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION; +import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS; +import static org.apache.geode.distributed.ConfigurationProperties.NAME; +import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_BUFFER_SIZE; +import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_LEASE_TIME; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_ENABLED_COMPONENTS; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE_PASSWORD; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_PROTOCOLS; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_REQUIRE_AUTHENTICATION; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_TRUSTSTORE; +import static
[geode] 02/03: GEODE-8540: Create new DistributedBlackboard Rule (#5557)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch backport-1-13-GEODE-8652-and-friends in repository https://gitbox.apache.org/repos/asf/geode.git commit 9a066e64b1722f914994fecb454a2f67f2a46148 Author: Kirk Lund AuthorDate: Wed Sep 30 09:39:30 2020 -0700 GEODE-8540: Create new DistributedBlackboard Rule (#5557) Package up DUnitBlackboard as a JUnit Rule named DistributedBlackboard. (cherry picked from commit 26cb822f2ee467545dd708ecc867cebbd2473c70) --- .../dunit/internal/DUnitBlackboardDUnitTest.java | 75 +++--- .../DistributedBlackboardDistributedTest.java | 297 + .../InternalBlackboard.java => Blackboard.java}| 54 ++-- .../apache/geode/test/dunit/DUnitBlackboard.java | 55 ++-- .../test/dunit/internal/InternalBlackboard.java| 33 ++- .../dunit/internal/InternalBlackboardImpl.java | 59 ++-- .../test/dunit/rules/DistributedBlackboard.java| 138 ++ 7 files changed, 584 insertions(+), 127 deletions(-) diff --git a/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java b/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java index ae78247..5e151d7 100755 --- a/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java +++ b/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java @@ -14,83 +14,70 @@ */ package org.apache.geode.test.dunit.internal; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static java.util.concurrent.TimeUnit.SECONDS; +import static org.apache.geode.test.dunit.VM.getVM; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.catchThrowable; -import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import org.junit.Test; -import org.apache.geode.test.dunit.Host; import org.apache.geode.test.dunit.VM; - +@SuppressWarnings("serial") public class DUnitBlackboardDUnitTest extends JUnit4DistributedTestCase { + @Test - public void canPassDataBetweenVMs() throws Exception { + public void canPassDataBetweenVMs() { final String MBOX = "myMailbox"; -VM vm0 = Host.getHost(0).getVM(0); -VM vm1 = Host.getHost(0).getVM(1); +VM vm0 = getVM(0); +VM vm1 = getVM(1); vm0.invoke("put data in mailbox", () -> getBlackboard().setMailbox(MBOX, "testing")); -String result = (String) vm1.invoke("get data from mailbox", () -> { - return getBlackboard().getMailbox(MBOX); -}); +String result = vm1.invoke("get data from mailbox", () -> getBlackboard().getMailbox(MBOX)); -assertEquals("testing", result); +assertThat(result).isEqualTo("testing"); } @Test - public void canSignalAnotherVM() throws Exception { + public void canSignalAnotherVM() { final String GATE = "myGate"; -VM vm0 = Host.getHost(0).getVM(0); -VM vm1 = Host.getHost(0).getVM(1); +VM vm0 = getVM(0); +VM vm1 = getVM(1); vm1.invoke("wait on gate not yet signalled", () -> { - assertFalse(getBlackboard().isGateSignaled(GATE)); - try { -getBlackboard().waitForGate(GATE, 1, TimeUnit.SECONDS); - } catch (TimeoutException e) { -// expected -return; - } catch (InterruptedException e) { -fail("unexpected interrupt"); - } - fail("unexpected success"); + assertThat(getBlackboard().isGateSignaled(GATE)).isFalse(); + + Throwable thrown = catchThrowable(() -> { +getBlackboard().waitForGate(GATE, 1, SECONDS); + }); + + assertThat(thrown).isInstanceOf(TimeoutException.class); }); vm0.invoke("signal gate", () -> getBlackboard().signalGate(GATE)); -vm1.invoke("wait on gate not yet signalled", () -> { - try { -getBlackboard().waitForGate(GATE, 1, TimeUnit.SECONDS); - } catch (TimeoutException e) { -fail("unexpected timeout"); - } catch (InterruptedException e) { -fail("unexpected interrupt"); - } - // success expected -}); +vm1.invoke("wait on gate not yet signalled", +() -> getBlackboard().waitForGate(GATE, 1, SECONDS)); } @Test - public void initBlackboardClearsEverything() throws Exception { + public void initBlackboardClearsEverything() { for (int i = 0; i < 100; i++) { getBlackboard().setMailbox("MBOX" + i, "value" + i); - assertEquals("value" + i, getBlackboard().getMailbox("MBOX" + i)); + assertThat((Object) getBlackboard().getMailbox("MBOX" + i)).isEqualTo("value" + i); + getBlackboard().signalGate("GATE" + i); -
[geode] 01/03: GEODE-8136: Move UncheckedUtils to geode-common (#5123)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch backport-1-13-GEODE-8652-and-friends in repository https://gitbox.apache.org/repos/asf/geode.git commit ca51909fe78be707376d9d411d709a4cea3bbdb2 Author: Kirk Lund AuthorDate: Tue May 26 10:24:44 2020 -0700 GEODE-8136: Move UncheckedUtils to geode-common (#5123) Create UncheckedUtilsTest to unit test UncheckedUtils. Extract FunctionExecution methods to new TypedFunctionService in geode-core. (cherry picked from commit 253d667b27423e55601e925f7a20f2fd6f0efc31) --- .../geode/util/internal}/UncheckedUtils.java | 19 --- .../geode/util/internal/UncheckedUtilsTest.java| 60 ++ .../cache/PartitionedRegionSingleHopDUnitTest.java | 14 ++--- ...istributedRegionFunctionExecutionDUnitTest.java | 59 +++-- ...oningWithColocationAndPersistenceDUnitTest.java | 12 ++--- .../FunctionExecutionOnLonerRegressionTest.java| 27 ++ .../client/internal/ClientMetadataService.java | 4 +- .../geode/internal/cache/GemFireCacheImpl.java | 49 -- .../cache/InternalCacheForClientAccess.java| 6 +-- .../apache/geode/internal/cache/LocalRegion.java | 7 ++- .../util/TypedFunctionService.java}| 20 +--- .../tier/sockets/CacheClientProxyFactory.java | 4 +- .../internal/ClusterAlertMessagingTest.java| 6 +-- .../apache/geode/internal/tcp/TCPConduitTest.java | 4 +- 14 files changed, 151 insertions(+), 140 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/util/UncheckedUtils.java b/geode-common/src/main/java/org/apache/geode/util/internal/UncheckedUtils.java similarity index 68% copy from geode-core/src/main/java/org/apache/geode/internal/cache/util/UncheckedUtils.java copy to geode-common/src/main/java/org/apache/geode/util/internal/UncheckedUtils.java index c03e990..61dbd8d 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/util/UncheckedUtils.java +++ b/geode-common/src/main/java/org/apache/geode/util/internal/UncheckedUtils.java @@ -12,18 +12,23 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ -package org.apache.geode.internal.cache.util; - -import org.apache.geode.cache.execute.Execution; +package org.apache.geode.util.internal; +/** + * Utilities for casting and working with unchecked raw types. + */ @SuppressWarnings({"unchecked", "unused"}) public class UncheckedUtils { - public static T cast(Object object) { -return (T) object; + protected UncheckedUtils() { +// do not instantiate } - public static Execution cast(Execution execution) { -return execution; + /** + * Casts an instance of a raw type to a parameterized type. Preference should be given to + * converting all code from using raw types to using parameterized types when possible. + */ + public static T uncheckedCast(Object object) { +return (T) object; } } diff --git a/geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java b/geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java new file mode 100644 index 000..7c282b7 --- /dev/null +++ b/geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java @@ -0,0 +1,60 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ +package org.apache.geode.util.internal; + +import static org.apache.geode.util.internal.UncheckedUtils.uncheckedCast; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.catchThrowable; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Test; + +@SuppressWarnings("unchecked") +public class UncheckedUtilsTest { + + @Test + public void uncheckedCast_rawList_empty() { +List rawList = new ArrayList(); + +List value = uncheckedCast(rawList); + +assertThat(value).isSameAs(rawList); + } + + @Test + public void uncheckedCast_rawList_nonEmpty() { +List rawList = new ArrayList(); +rawList.add("1"); +rawList.add("2"); + +List
[geode] branch backport-1-13-GEODE-8652-and-friends created (now 0906b08)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a change to branch backport-1-13-GEODE-8652-and-friends in repository https://gitbox.apache.org/repos/asf/geode.git. at 0906b08 GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666) This branch includes the following new commits: new ca51909 GEODE-8136: Move UncheckedUtils to geode-common (#5123) new 9a066e6 GEODE-8540: Create new DistributedBlackboard Rule (#5557) new 0906b08 GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666) The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.