blob: bbd10cb31d96e59d194560454000cd9870d0d7b6 [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
Jonathan Harta99ec672014-04-03 11:30:34 -07009import org.openflow.protocol.OFBarrierReply;
10import org.openflow.protocol.OFMessage;
11import org.openflow.protocol.OFType;
12
Naoki Shiota81dbe302013-11-21 15:35:38 -080013public 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}