blob: 3de5a7d6f66a00ffff19aa33a5f0846e0349fc97 [file] [log] [blame]
Saurav Dasd84178f2014-09-29 17:48:54 -07001package net.floodlightcontroller.core.internal;
2
3import java.util.concurrent.TimeUnit;
4
5import net.floodlightcontroller.core.IOFSwitch;
6import net.floodlightcontroller.threadpool.IThreadPoolService;
7
8import org.projectfloodlight.openflow.protocol.OFBarrierReply;
9import org.projectfloodlight.openflow.protocol.OFMessage;
10import org.projectfloodlight.openflow.protocol.OFType;
11
12public 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}