Improve segmented journal actor metrics
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / messages / OnDemandShardState.java
1 /*
2  * Copyright (c) 2017 Brocade Communications Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.cluster.datastore.messages;
9
10 import akka.actor.ActorRef;
11 import akka.actor.ActorSelection;
12 import java.util.Collection;
13 import org.opendaylight.controller.cluster.raft.client.messages.OnDemandRaftState;
14
15 /**
16  * Extends OnDemandRaftState to add Shard state.
17  *
18  * @author Thomas Pantelis
19  */
20 public class OnDemandShardState extends OnDemandRaftState {
21     private Collection<ActorSelection> treeChangeListenerActors;
22     private Collection<ActorRef> commitCohortActors;
23
24     public Collection<ActorSelection> getTreeChangeListenerActors() {
25         return treeChangeListenerActors;
26     }
27
28     public Collection<ActorRef> getCommitCohortActors() {
29         return commitCohortActors;
30     }
31
32     public static Builder newBuilder() {
33         return new Builder();
34     }
35
36     public static class Builder extends AbstractBuilder<Builder, OnDemandShardState> {
37         private final OnDemandShardState state = new OnDemandShardState();
38
39         @Override
40         protected OnDemandRaftState state() {
41             return state;
42         }
43
44         public Builder treeChangeListenerActors(Collection<ActorSelection> actors) {
45             state.treeChangeListenerActors = actors;
46             return self();
47         }
48
49         public Builder commitCohortActors(Collection<ActorRef> actors) {
50             state.commitCohortActors = actors;
51             return self();
52         }
53
54         @Override
55         public OnDemandShardState build() {
56             return super.build();
57         }
58     }
59 }