Improve segmented journal actor metrics
[controller.git] / opendaylight / md-sal / eos-dom-akka / src / main / java / org / opendaylight / controller / eos / akka / registry / listener / type / command / EntityOwnerChanged.java
1 /*
2  * Copyright (c) 2021 PANTHEON.tech, s.r.o. 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.eos.akka.registry.listener.type.command;
9
10 import static java.util.Objects.requireNonNull;
11
12 import com.google.common.base.MoreObjects;
13 import org.eclipse.jdt.annotation.NonNullByDefault;
14 import org.opendaylight.controller.eos.akka.registry.listener.type.EntityTypeListenerActor;
15 import org.opendaylight.mdsal.eos.common.api.EntityOwnershipStateChange;
16 import org.opendaylight.mdsal.eos.dom.api.DOMEntity;
17
18 /**
19  * Notification sent to {@link EntityTypeListenerActor} when there is an owner change for an Entity of a given type.
20  */
21 @NonNullByDefault
22 public final class EntityOwnerChanged extends TypeListenerCommand {
23     private final DOMEntity entity;
24     private final EntityOwnershipStateChange change;
25     private final boolean inJeopardy;
26
27     public EntityOwnerChanged(final DOMEntity entity, final EntityOwnershipStateChange change,
28             final boolean inJeopardy) {
29         this.entity = requireNonNull(entity);
30         this.change = requireNonNull(change);
31         this.inJeopardy = requireNonNull(inJeopardy);
32     }
33
34     public DOMEntity entity() {
35         return entity;
36     }
37
38     public EntityOwnershipStateChange change() {
39         return change;
40     }
41
42     public boolean inJeopardy() {
43         return inJeopardy;
44     }
45
46     @Override
47     public String toString() {
48         return MoreObjects.toStringHelper(this)
49             .add("entity", entity)
50             .add("change", change)
51             .add("inJeopardy", inJeopardy)
52             .toString();
53     }
54 }