import java.util.Optional;
import java.util.Set;
import org.eclipse.jdt.annotation.Nullable;
-import org.opendaylight.controller.cluster.access.concepts.MemberName;
import org.opendaylight.controller.cluster.datastore.DatastoreContext;
import org.opendaylight.controller.cluster.datastore.Shard;
import org.opendaylight.controller.cluster.datastore.identifiers.ShardIdentifier;
import org.opendaylight.controller.cluster.datastore.messages.PeerAddressResolved;
-import org.opendaylight.controller.cluster.datastore.messages.PeerDown;
-import org.opendaylight.controller.cluster.datastore.messages.PeerUp;
import org.opendaylight.controller.cluster.datastore.shardmanager.ShardManager.OnShardInitialized;
import org.opendaylight.controller.cluster.datastore.shardmanager.ShardManager.OnShardReady;
import org.opendaylight.controller.cluster.raft.RaftState;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.ReadOnlyDataTree;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.data.tree.api.ReadOnlyDataTree;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
}
void setLocalDataTree(final Optional<ReadOnlyDataTree> dataTree) {
- this.localShardDataTree = dataTree;
+ localShardDataTree = dataTree;
}
Optional<ReadOnlyDataTree> getLocalShardDataTree() {
}
void setDatastoreContext(final DatastoreContext newDatastoreContext, final ActorRef sender) {
- this.datastoreContext = newDatastoreContext;
+ datastoreContext = newDatastoreContext;
if (actor != null) {
LOG.debug("Sending new DatastoreContext to {}", shardId);
- actor.tell(this.datastoreContext, sender);
+ actor.tell(datastoreContext, sender);
}
}
notifyOnShardInitializedCallbacks();
}
- void peerDown(final MemberName memberName, final String peerId, final ActorRef sender) {
- if (actor != null) {
- actor.tell(new PeerDown(memberName, peerId), sender);
- }
- }
-
- void peerUp(final MemberName memberName, final String peerId, final ActorRef sender) {
- if (actor != null) {
- actor.tell(new PeerUp(memberName, peerId), sender);
- }
- }
-
boolean isShardReady() {
return !RaftState.Candidate.name().equals(role) && !Strings.isNullOrEmpty(role);
}
}
String getSerializedLeaderActor() {
- if (isLeader()) {
- return Serialization.serializedActorPath(getActor());
- } else {
- return addressResolver.resolve(leaderId);
- }
+ return isLeader() ? Serialization.serializedActorPath(getActor()) : addressResolver.resolve(leaderId);
}
void setActorInitialized() {
LOG.debug("Shard {} is initialized", shardId);
- this.actorInitialized = true;
+ actorInitialized = true;
notifyOnShardInitializedCallbacks();
}
return;
}
- boolean ready = isShardReadyWithLeaderId();
-
- LOG.debug("Shard {} is {} - notifying {} OnShardInitialized callbacks", shardId,
- ready ? "ready" : "initialized", onShardInitializedSet.size());
+ final boolean ready = isShardReadyWithLeaderId();
+ final String readyStr = ready ? "ready" : "initialized";
+ LOG.debug("Shard {} is {} - notifying {} OnShardInitialized callbacks", shardId, readyStr,
+ onShardInitializedSet.size());
Iterator<OnShardInitialized> iter = onShardInitializedSet.iterator();
while (iter.hasNext()) {
}
void setRole(final String newRole) {
- this.role = newRole;
+ role = newRole;
notifyOnShardInitializedCallbacks();
}
}
void setFollowerSyncStatus(final boolean syncStatus) {
- this.followerSyncStatus = syncStatus;
+ followerSyncStatus = syncStatus;
}
boolean isInSync() {
- if (RaftState.Follower.name().equals(this.role)) {
+ if (RaftState.Follower.name().equals(role)) {
return followerSyncStatus;
- } else if (RaftState.Leader.name().equals(this.role)) {
+ } else if (RaftState.Leader.name().equals(role)) {
return true;
}
}
boolean setLeaderId(final String newLeaderId) {
- final boolean changed = !Objects.equals(this.leaderId, newLeaderId);
- this.leaderId = newLeaderId;
+ final boolean changed = !Objects.equals(leaderId, newLeaderId);
+ leaderId = newLeaderId;
if (newLeaderId != null) {
- this.leaderAvailable = true;
+ leaderAvailable = true;
}
notifyOnShardInitializedCallbacks();
}
void setActiveMember(final boolean isActiveMember) {
- this.activeMember = isActiveMember;
+ activeMember = isActiveMember;
}
- SchemaContext getSchemaContext() {
- return schemaContextProvider.getSchemaContext();
+ EffectiveModelContext getSchemaContext() {
+ return schemaContextProvider.getEffectiveModelContext();
}
- void setSchemaContext(final SchemaContext schemaContext) {
+ void setSchemaContext(final EffectiveModelContext schemaContext) {
schemaContextProvider.set(requireNonNull(schemaContext));
}