tom | 1d416c5 | 2014-09-29 20:55:24 -0700 | [diff] [blame] | 1 | package org.onlab.onos.store.cluster.messaging; |
| 2 | |
| 3 | import org.onlab.nio.AbstractMessage; |
| 4 | |
| 5 | import static com.google.common.base.MoreObjects.toStringHelper; |
| 6 | |
| 7 | /** |
| 8 | * Base message for cluster-wide communications. |
| 9 | */ |
| 10 | public abstract class ClusterMessage extends AbstractMessage { |
| 11 | |
| 12 | private final MessageSubject subject; |
| 13 | |
| 14 | /** |
| 15 | * Creates a cluster message. |
| 16 | * |
| 17 | * @param subject message subject |
| 18 | */ |
| 19 | protected ClusterMessage(MessageSubject subject) { |
| 20 | this.subject = subject; |
| 21 | } |
| 22 | |
| 23 | /** |
| 24 | * Returns the message subject indicator. |
| 25 | * |
| 26 | * @return message subject |
| 27 | */ |
| 28 | public MessageSubject subject() { |
| 29 | return subject; |
| 30 | } |
| 31 | |
| 32 | @Override |
| 33 | public String toString() { |
| 34 | return toStringHelper(this).add("subject", subject).add("length", length).toString(); |
| 35 | } |
| 36 | |
| 37 | } |