From 9b0e2571b0409194cb211eeadecbd476c67fd07e Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Wed, 16 Oct 2019 12:32:42 +0200 Subject: [PATCH] Split DistributedShardRegistration into its own file This interface is holding us back at Java 10 due to ARIES-1923, as blueprint fails to process DistributedShardFactory. As this interface really is private, factor DistributedShardRegistration into its own file and move to Java 11. Change-Id: Idea1c31b7e82a9df5cef34da8e2bd95bb51d4f00 Signed-off-by: Robert Varga --- .../md-sal/sal-distributed-datastore/pom.xml | 5 ---- .../sharding/DistributedShardFactory.java | 15 ----------- .../DistributedShardRegistration.java | 25 +++++++++++++++++++ ...ributedShardedDOMDataTreeRemotingTest.java | 1 - .../DistributedShardedDOMDataTreeTest.java | 1 - .../it/provider/impl/PrefixShardHandler.java | 2 +- 6 files changed, 26 insertions(+), 23 deletions(-) create mode 100644 opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/DistributedShardRegistration.java diff --git a/opendaylight/md-sal/sal-distributed-datastore/pom.xml b/opendaylight/md-sal/sal-distributed-datastore/pom.xml index a53d59139e..045083f7d9 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/pom.xml +++ b/opendaylight/md-sal/sal-distributed-datastore/pom.xml @@ -12,11 +12,6 @@ 1.11.0-SNAPSHOT bundle - - - 10 - - diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/DistributedShardFactory.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/DistributedShardFactory.java index f1cdcd8dda..fba71ab117 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/DistributedShardFactory.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/DistributedShardFactory.java @@ -5,7 +5,6 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ - package org.opendaylight.controller.cluster.sharding; import com.google.common.annotations.Beta; @@ -22,7 +21,6 @@ import org.opendaylight.mdsal.dom.api.DOMDataTreeShardingConflictException; */ @Beta public interface DistributedShardFactory { - /** * Register a new shard that is rooted at the desired prefix with replicas on the provided members. * Note to register a shard without replicas you still need to provide at least one Member for the shard. @@ -38,17 +36,4 @@ public interface DistributedShardFactory { CompletionStage createDistributedShard(DOMDataTreeIdentifier prefix, Collection replicaMembers) throws DOMDataTreeShardingConflictException; - - /** - * Registration of the CDS shard that allows you to remove the shard from the system by closing the registration. - * This removal is done asynchronously. - */ - interface DistributedShardRegistration { - - /** - * Removes the shard from the system, this removal is done asynchronously, the future completes once the - * backend shard is no longer present. - */ - CompletionStage close(); - } } \ No newline at end of file diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/DistributedShardRegistration.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/DistributedShardRegistration.java new file mode 100644 index 0000000000..0f94bc5e1f --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/DistributedShardRegistration.java @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.controller.cluster.sharding; + +import com.google.common.annotations.Beta; +import java.util.concurrent.CompletionStage; + +/** + * Registration of the CDS shard that allows you to remove the shard from the system by closing the registration. + * This removal is done asynchronously. + */ +@Beta +public interface DistributedShardRegistration { + + /** + * Removes the shard from the system, this removal is done asynchronously, the future completes once the + * backend shard is no longer present. + */ + CompletionStage close(); +} diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/sharding/DistributedShardedDOMDataTreeRemotingTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/sharding/DistributedShardedDOMDataTreeRemotingTest.java index a8249611bf..6f4611f25b 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/sharding/DistributedShardedDOMDataTreeRemotingTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/sharding/DistributedShardedDOMDataTreeRemotingTest.java @@ -41,7 +41,6 @@ import org.opendaylight.controller.cluster.datastore.IntegrationTestKit; import org.opendaylight.controller.cluster.datastore.utils.ClusterUtils; import org.opendaylight.controller.cluster.raft.utils.InMemoryJournal; import org.opendaylight.controller.cluster.raft.utils.InMemorySnapshotStore; -import org.opendaylight.controller.cluster.sharding.DistributedShardFactory.DistributedShardRegistration; import org.opendaylight.controller.md.cluster.datastore.model.SchemaContextHelper; import org.opendaylight.controller.md.cluster.datastore.model.TestModel; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/sharding/DistributedShardedDOMDataTreeTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/sharding/DistributedShardedDOMDataTreeTest.java index 68c16dc86d..8f9002c256 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/sharding/DistributedShardedDOMDataTreeTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/sharding/DistributedShardedDOMDataTreeTest.java @@ -68,7 +68,6 @@ import org.opendaylight.controller.cluster.dom.api.CDSDataTreeProducer; import org.opendaylight.controller.cluster.dom.api.CDSShardAccess; import org.opendaylight.controller.cluster.raft.utils.InMemoryJournal; import org.opendaylight.controller.cluster.raft.utils.InMemorySnapshotStore; -import org.opendaylight.controller.cluster.sharding.DistributedShardFactory.DistributedShardRegistration; import org.opendaylight.controller.md.cluster.datastore.model.SchemaContextHelper; import org.opendaylight.controller.md.cluster.datastore.model.TestModel; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; diff --git a/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/impl/PrefixShardHandler.java b/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/impl/PrefixShardHandler.java index dcbedd6650..a58883c3e2 100644 --- a/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/impl/PrefixShardHandler.java +++ b/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/impl/PrefixShardHandler.java @@ -24,7 +24,7 @@ import java.util.concurrent.CompletionStage; import java.util.stream.Collectors; import org.opendaylight.controller.cluster.access.concepts.MemberName; import org.opendaylight.controller.cluster.sharding.DistributedShardFactory; -import org.opendaylight.controller.cluster.sharding.DistributedShardFactory.DistributedShardRegistration; +import org.opendaylight.controller.cluster.sharding.DistributedShardRegistration; import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.mdsal.dom.api.DOMDataTreeCursorAwareTransaction; -- 2.36.6