2 * Copyright (c) 2015 Brocade Communications Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.controller.cluster.datastore.messages;
10 import com.google.common.base.Preconditions;
11 import java.io.IOException;
12 import java.io.ObjectInput;
13 import java.io.ObjectOutput;
14 import org.opendaylight.controller.cluster.datastore.modification.MutableCompositeModification;
17 * Message used to batch write, merge, delete modification operations to the ShardTransaction actor.
19 * @author Thomas Pantelis
21 public class BatchedModifications extends MutableCompositeModification implements SerializableMessage {
22 private static final long serialVersionUID = 1L;
24 private boolean ready;
25 private String transactionID;
26 private String transactionChainID;
28 public BatchedModifications() {
31 public BatchedModifications(String transactionID, short version, String transactionChainID) {
33 this.transactionID = Preconditions.checkNotNull(transactionID, "transactionID can't be null");
34 this.transactionChainID = transactionChainID != null ? transactionChainID : "";
37 public boolean isReady() {
41 public void setReady(boolean ready) {
45 public String getTransactionID() {
49 public String getTransactionChainID() {
50 return transactionChainID;
54 public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
55 super.readExternal(in);
56 transactionID = in.readUTF();
57 transactionChainID = in.readUTF();
58 ready = in.readBoolean();
62 public void writeExternal(ObjectOutput out) throws IOException {
63 super.writeExternal(out);
64 out.writeUTF(transactionID);
65 out.writeUTF(transactionChainID);
66 out.writeBoolean(ready);
70 public Object toSerializable() {
75 public String toString() {
76 StringBuilder builder = new StringBuilder();
77 builder.append("BatchedModifications [transactionID=").append(transactionID).append(", ready=").append(ready)
78 .append(", modifications size=").append(getModifications().size()).append("]");
79 return builder.toString();