blob: 501eaa6a3668987c4f5ef620845d5ae92eeba6ca [file] [log] [blame]
Naoki Shiota81dbe302013-11-21 15:35:38 -08001package net.onrc.onos.ofcontroller.flowprogrammer;
2
3import java.util.concurrent.TimeUnit;
4
5import org.openflow.protocol.OFBarrierReply;
6import org.openflow.protocol.OFMessage;
7import org.openflow.protocol.OFType;
8
9import net.floodlightcontroller.core.IOFSwitch;
10import net.floodlightcontroller.core.internal.OFMessageFuture;
11import net.floodlightcontroller.threadpool.IThreadPoolService;
12
13public class OFBarrierReplyFuture extends OFMessageFuture<OFBarrierReply> {
14
15 protected volatile boolean finished;
16
17 public OFBarrierReplyFuture(IThreadPoolService tp,
Ray Milkey8e5170e2014-04-02 12:09:55 -070018 IOFSwitch sw, int transactionId) {
Naoki Shiota81dbe302013-11-21 15:35:38 -080019 super(tp, sw, OFType.FEATURES_REPLY, transactionId);
20 init();
21 }
22
23 public OFBarrierReplyFuture(IThreadPoolService tp,
Ray Milkey8e5170e2014-04-02 12:09:55 -070024 IOFSwitch sw, int transactionId, long timeout, TimeUnit unit) {
Naoki Shiota81dbe302013-11-21 15:35:38 -080025 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}