blob: 39910190c2f125ad55ea383f835266ffdf0dea87 [file] [log] [blame]
Jonathan Hart23701d12014-04-03 10:45:48 -07001package net.onrc.onos.core.flowprogrammer;
Naoki Shiota81dbe302013-11-21 15:35:38 -08002
3import java.util.concurrent.TimeUnit;
4
Naoki Shiota81dbe302013-11-21 15:35:38 -08005import net.floodlightcontroller.core.IOFSwitch;
6import net.floodlightcontroller.core.internal.OFMessageFuture;
7import net.floodlightcontroller.threadpool.IThreadPoolService;
8
Brian O'Connorc67f9fa2014-08-07 18:17:46 -07009import org.projectfloodlight.openflow.protocol.OFBarrierReply;
10import org.projectfloodlight.openflow.protocol.OFMessage;
11import org.projectfloodlight.openflow.protocol.OFType;
12
13//XXX S note that other places are using old OFBarrierReply - so we broke that
Jonathan Harta99ec672014-04-03 11:30:34 -070014
Naoki Shiota81dbe302013-11-21 15:35:38 -080015public class OFBarrierReplyFuture extends OFMessageFuture<OFBarrierReply> {
16
17 protected volatile boolean finished;
18
19 public OFBarrierReplyFuture(IThreadPoolService tp,
Brian O'Connorc67f9fa2014-08-07 18:17:46 -070020 IOFSwitch sw, int transactionId) {
Naoki Shiota81dbe302013-11-21 15:35:38 -080021 super(tp, sw, OFType.FEATURES_REPLY, transactionId);
22 init();
23 }
24
25 public OFBarrierReplyFuture(IThreadPoolService tp,
Brian O'Connorc67f9fa2014-08-07 18:17:46 -070026 IOFSwitch sw, int transactionId, long timeout, TimeUnit unit) {
Naoki Shiota81dbe302013-11-21 15:35:38 -080027 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}