2 * Copyright (c) 2013 Cisco 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
9 package org.opendaylight.controller.protocol_plugin.openflow.core.internal;
11 import java.util.concurrent.atomic.AtomicLong;
13 import org.apache.commons.lang3.builder.EqualsBuilder;
14 import org.apache.commons.lang3.builder.HashCodeBuilder;
15 import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
16 import org.openflow.protocol.OFMessage;
19 * This class describes an OpenFlow message with priority
21 class PriorityMessage {
24 final static AtomicLong seq = new AtomicLong();
26 boolean syncReply; // set to true if we want to be blocked until the response arrives
28 public PriorityMessage(OFMessage msg, int priority) {
30 this.priority = priority;
31 this.seqNum = seq.getAndIncrement();
32 this.syncReply = false;
35 public PriorityMessage(OFMessage msg, int priority, boolean syncReply) {
37 this.syncReply = syncReply;
40 public OFMessage getMsg() {
44 public void setMsg(OFMessage msg) {
48 public int getPriority() {
52 public void setPriority(int priority) {
53 this.priority = priority;
57 public int hashCode() {
58 return HashCodeBuilder.reflectionHashCode(this);
62 public boolean equals(Object obj) {
63 return EqualsBuilder.reflectionEquals(this, obj);
67 public String toString() {
68 return "PriorityMessage[" + ReflectionToStringBuilder.toString(this)