Naoki Shiota | 81dbe30 | 2013-11-21 15:35:38 -0800 | [diff] [blame] | 1 | package net.onrc.onos.ofcontroller.flowprogrammer; |
| 2 | |
| 3 | import java.util.concurrent.TimeUnit; |
| 4 | |
| 5 | import org.openflow.protocol.OFBarrierReply; |
| 6 | import org.openflow.protocol.OFMessage; |
| 7 | import org.openflow.protocol.OFType; |
| 8 | |
| 9 | import net.floodlightcontroller.core.IOFSwitch; |
| 10 | import net.floodlightcontroller.core.internal.OFMessageFuture; |
| 11 | import net.floodlightcontroller.threadpool.IThreadPoolService; |
| 12 | |
| 13 | public class OFBarrierReplyFuture extends OFMessageFuture<OFBarrierReply> { |
| 14 | |
| 15 | protected volatile boolean finished; |
| 16 | |
| 17 | public OFBarrierReplyFuture(IThreadPoolService tp, |
| 18 | IOFSwitch sw, int transactionId) { |
| 19 | super(tp, sw, OFType.FEATURES_REPLY, transactionId); |
| 20 | init(); |
| 21 | } |
| 22 | |
| 23 | public OFBarrierReplyFuture(IThreadPoolService tp, |
| 24 | IOFSwitch sw, int transactionId, long timeout, TimeUnit unit) { |
| 25 | super(tp, sw, OFType.FEATURES_REPLY, transactionId, timeout, unit); |
| 26 | init(); |
| 27 | } |
| 28 | |
| 29 | private void init() { |
| 30 | this.finished = false; |
| 31 | this.result = null; |
| 32 | } |
| 33 | |
| 34 | @Override |
| 35 | protected void handleReply(IOFSwitch sw, OFMessage msg) { |
| 36 | this.result = (OFBarrierReply) msg; |
| 37 | this.finished = true; |
| 38 | } |
| 39 | |
| 40 | @Override |
| 41 | protected boolean isFinished() { |
| 42 | return finished; |
| 43 | } |
| 44 | |
| 45 | @Override |
| 46 | protected void unRegister() { |
| 47 | super.unRegister(); |
| 48 | } |
| 49 | } |