Jonathan Hart | 23701d1 | 2014-04-03 10:45:48 -0700 | [diff] [blame] | 1 | package net.onrc.onos.core.flowprogrammer; |
Naoki Shiota | 81dbe30 | 2013-11-21 15:35:38 -0800 | [diff] [blame] | 2 | |
| 3 | import java.util.concurrent.TimeUnit; |
| 4 | |
Naoki Shiota | 81dbe30 | 2013-11-21 15:35:38 -0800 | [diff] [blame] | 5 | import net.floodlightcontroller.core.IOFSwitch; |
| 6 | import net.floodlightcontroller.core.internal.OFMessageFuture; |
| 7 | import net.floodlightcontroller.threadpool.IThreadPoolService; |
| 8 | |
Brian O'Connor | c67f9fa | 2014-08-07 18:17:46 -0700 | [diff] [blame] | 9 | import org.projectfloodlight.openflow.protocol.OFBarrierReply; |
| 10 | import org.projectfloodlight.openflow.protocol.OFMessage; |
| 11 | import org.projectfloodlight.openflow.protocol.OFType; |
| 12 | |
| 13 | //XXX S note that other places are using old OFBarrierReply - so we broke that |
Jonathan Hart | a99ec67 | 2014-04-03 11:30:34 -0700 | [diff] [blame] | 14 | |
Naoki Shiota | 81dbe30 | 2013-11-21 15:35:38 -0800 | [diff] [blame] | 15 | public class OFBarrierReplyFuture extends OFMessageFuture<OFBarrierReply> { |
| 16 | |
| 17 | protected volatile boolean finished; |
| 18 | |
| 19 | public OFBarrierReplyFuture(IThreadPoolService tp, |
Brian O'Connor | c67f9fa | 2014-08-07 18:17:46 -0700 | [diff] [blame] | 20 | IOFSwitch sw, int transactionId) { |
Naoki Shiota | 81dbe30 | 2013-11-21 15:35:38 -0800 | [diff] [blame] | 21 | super(tp, sw, OFType.FEATURES_REPLY, transactionId); |
| 22 | init(); |
| 23 | } |
| 24 | |
| 25 | public OFBarrierReplyFuture(IThreadPoolService tp, |
Brian O'Connor | c67f9fa | 2014-08-07 18:17:46 -0700 | [diff] [blame] | 26 | IOFSwitch sw, int transactionId, long timeout, TimeUnit unit) { |
Naoki Shiota | 81dbe30 | 2013-11-21 15:35:38 -0800 | [diff] [blame] | 27 | super(tp, sw, OFType.FEATURES_REPLY, transactionId, timeout, unit); |
| 28 | init(); |
| 29 | } |
| 30 | |
| 31 | private void init() { |
| 32 | this.finished = false; |
| 33 | this.result = null; |
| 34 | } |
| 35 | |
| 36 | @Override |
| 37 | protected void handleReply(IOFSwitch sw, OFMessage msg) { |
| 38 | this.result = (OFBarrierReply) msg; |
| 39 | this.finished = true; |
| 40 | } |
| 41 | |
| 42 | @Override |
| 43 | protected boolean isFinished() { |
| 44 | return finished; |
| 45 | } |
| 46 | |
| 47 | @Override |
| 48 | protected void unRegister() { |
| 49 | super.unRegister(); |
| 50 | } |
| 51 | } |