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