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.openflow.protocol.OFMessage;
16 * This class describes an OpenFlow message with priority
18 class PriorityMessage {
21 final static AtomicLong seq = new AtomicLong();
23 boolean syncReply; // set to true if we want to be blocked until the response arrives
25 public PriorityMessage(OFMessage msg, int priority) {
27 this.priority = priority;
28 this.seqNum = seq.getAndIncrement();
29 this.syncReply = false;
32 public PriorityMessage(OFMessage msg, int priority, boolean syncReply) {
34 this.syncReply = syncReply;
37 public OFMessage getMsg() {
41 public void setMsg(OFMessage msg) {
45 public int getPriority() {
49 public void setPriority(int priority) {
50 this.priority = priority;
54 public int hashCode() {
57 result = prime * result + ((msg == null) ? 0 : msg.hashCode());
58 result = prime * result + priority;
59 result = prime * result + (int) (seqNum ^ (seqNum >>> 32));
60 result = prime * result + (syncReply ? 1231 : 1237);
65 public boolean equals(Object obj) {
70 if (getClass() != obj.getClass())
72 PriorityMessage other = (PriorityMessage) obj;
74 if (other.msg != null)
76 } else if (!msg.equals(other.msg))
78 if (priority != other.priority)
80 if (seqNum != other.seqNum)
82 if (syncReply != other.syncReply)
88 public String toString() {
89 return "PriorityMessage [msg=" + msg + ", priority=" + priority
90 + ", seqNum=" + seqNum + ", syncReply=" + syncReply + "]";