Java 类net.floodlightcontroller.core.DeliverableListenableFuture 实例源码

项目:fresco_floodlight    文件:OFConnection.java   
@Override
public <R extends OFMessage> ListenableFuture<R> writeRequest(OFRequest<R> request) {
    if (!isConnected()) {
        return Futures.immediateFailedFuture(new SwitchDisconnectedException(getDatapathId()));
    }

    DeliverableListenableFuture<R> future = new DeliverableListenableFuture<R>();
    xidDeliverableMap.put(request.getXid(), future);
    listener.messageWritten(this, request);
    this.write(request);
    return future;
}
项目:SDN-Multicast    文件:OFConnection.java   
@Override
public <R extends OFMessage> ListenableFuture<R> writeRequest(OFRequest<R> request) {
    if (!isConnected()) {
        return Futures.immediateFailedFuture(new SwitchDisconnectedException(getDatapathId()));
    }

    DeliverableListenableFuture<R> future = new DeliverableListenableFuture<R>();
    xidDeliverableMap.put(request.getXid(), future);
    listener.messageWritten(this, request);
    this.write(request);
    return future;
}
项目:arscheduler    文件:OFConnection.java   
@Override
public <R extends OFMessage> ListenableFuture<R> writeRequest(OFRequest<R> request) {
    if (!isConnected()) {
        return Futures.immediateFailedFuture(new SwitchDisconnectedException(getDatapathId()));
    }

    DeliverableListenableFuture<R> future = new DeliverableListenableFuture<R>();
    xidDeliverableMap.put(request.getXid(), future);
    listener.messageWritten(this, request);
    this.write(request);
    return future;
}
项目:floodlight1.2-delay    文件:OFConnection.java   
@Override
public <R extends OFMessage> ListenableFuture<R> writeRequest(OFRequest<R> request) {
    if (!isConnected()) {
        return Futures.immediateFailedFuture(new SwitchDisconnectedException(getDatapathId()));
    }

    DeliverableListenableFuture<R> future = new DeliverableListenableFuture<R>();
    xidDeliverableMap.put(request.getXid(), future);
    listener.messageWritten(this, request);
    this.write(request);
    return future;
}
项目:floodlight-hardware    文件:OFConnection.java   
@Override
public <R extends OFMessage> ListenableFuture<R> writeRequest(OFRequest<R> request) {
    if (!isConnected()) {
        return Futures.immediateFailedFuture(new SwitchDisconnectedException(getDatapathId()));
    }

    DeliverableListenableFuture<R> future = new DeliverableListenableFuture<R>();
    xidDeliverableMap.put(request.getXid(), future);
    listener.messageWritten(this, request);
    this.write(request);
    return future;
}
项目:ACAMPController    文件:OFConnection.java   
@Override
public <R extends OFMessage> ListenableFuture<R> writeRequest(OFRequest<R> request) {
    if (!isConnected()) {
        return Futures.immediateFailedFuture(new SwitchDisconnectedException(getDatapathId()));
    }

    DeliverableListenableFuture<R> future = new DeliverableListenableFuture<R>();
    xidDeliverableMap.put(request.getXid(), future);
    listener.messageWritten(this, request);
    this.write(request);
    return future;
}
项目:fresco_floodlight    文件:OFConnection.java   
@Override
public <REPLY extends OFStatsReply> ListenableFuture<List<REPLY>> writeStatsRequest(
        OFStatsRequest<REPLY> request) {
    if (!isConnected()) {
        return Futures.immediateFailedFuture(new SwitchDisconnectedException(getDatapathId()));
    }

    final DeliverableListenableFuture<List<REPLY>> future =
            new DeliverableListenableFuture<List<REPLY>>();

    Deliverable<REPLY> deliverable = new Deliverable<REPLY>() {
        private final List<REPLY> results = Collections
                .synchronizedList(new ArrayList<REPLY>());

        @Override
        public void deliver(REPLY reply) {
            results.add(reply);
            if (!reply.getFlags().contains(OFStatsReplyFlags.REPLY_MORE)) {
                // done
                future.deliver(results);
            }
        }

        @Override
        public void deliverError(Throwable cause) {
            future.deliverError(cause);
        }

        @Override
        public boolean isDone() {
            return future.isDone();
        }

        @Override
        public boolean cancel(boolean mayInterruptIfRunning) {
            return future.cancel(mayInterruptIfRunning);
        }
    };

    registerDeliverable(request.getXid(), deliverable);
    this.write(request);
    return future;
}
项目:SDN-Multicast    文件:OFConnection.java   
@Override
public <REPLY extends OFStatsReply> ListenableFuture<List<REPLY>> writeStatsRequest(
        OFStatsRequest<REPLY> request) {
    if (!isConnected()) {
        return Futures.immediateFailedFuture(new SwitchDisconnectedException(getDatapathId()));
    }

    final DeliverableListenableFuture<List<REPLY>> future =
            new DeliverableListenableFuture<List<REPLY>>();

    Deliverable<REPLY> deliverable = new Deliverable<REPLY>() {
        private final List<REPLY> results = Collections
                .synchronizedList(new ArrayList<REPLY>());

        @Override
        public void deliver(REPLY reply) {
            results.add(reply);
            if (!reply.getFlags().contains(OFStatsReplyFlags.REPLY_MORE)) {
                // done
                future.deliver(results);
            }
        }

        @Override
        public void deliverError(Throwable cause) {
            future.deliverError(cause);
        }

        @Override
        public boolean isDone() {
            return future.isDone();
        }

        @Override
        public boolean cancel(boolean mayInterruptIfRunning) {
            return future.cancel(mayInterruptIfRunning);
        }
    };

    registerDeliverable(request.getXid(), deliverable);
    this.write(request);
    return future;
}
项目:arscheduler    文件:OFConnection.java   
@Override
public <REPLY extends OFStatsReply> ListenableFuture<List<REPLY>> writeStatsRequest(
        OFStatsRequest<REPLY> request) {
    if (!isConnected()) {
        return Futures.immediateFailedFuture(new SwitchDisconnectedException(getDatapathId()));
    }

    final DeliverableListenableFuture<List<REPLY>> future =
            new DeliverableListenableFuture<List<REPLY>>();

    Deliverable<REPLY> deliverable = new Deliverable<REPLY>() {
        private final List<REPLY> results = Collections
                .synchronizedList(new ArrayList<REPLY>());

        @Override
        public void deliver(REPLY reply) {
            results.add(reply);
            if (!reply.getFlags().contains(OFStatsReplyFlags.REPLY_MORE)) {
                // done
                future.deliver(results);
            }
        }

        @Override
        public void deliverError(Throwable cause) {
            future.deliverError(cause);
        }

        @Override
        public boolean isDone() {
            return future.isDone();
        }

        @Override
        public boolean cancel(boolean mayInterruptIfRunning) {
            return future.cancel(mayInterruptIfRunning);
        }
    };

    registerDeliverable(request.getXid(), deliverable);
    this.write(request);
    return future;
}
项目:floodlight1.2-delay    文件:OFConnection.java   
@Override
public <REPLY extends OFStatsReply> ListenableFuture<List<REPLY>> writeStatsRequest(
        OFStatsRequest<REPLY> request) {
    if (!isConnected()) {
        return Futures.immediateFailedFuture(new SwitchDisconnectedException(getDatapathId()));
    }

    final DeliverableListenableFuture<List<REPLY>> future =
            new DeliverableListenableFuture<List<REPLY>>();

    Deliverable<REPLY> deliverable = new Deliverable<REPLY>() {
        private final List<REPLY> results = Collections
                .synchronizedList(new ArrayList<REPLY>());

        @Override
        public void deliver(REPLY reply) {
            results.add(reply);
            if (!reply.getFlags().contains(OFStatsReplyFlags.REPLY_MORE)) {
                // done
                future.deliver(results);
            }
        }

        @Override
        public void deliverError(Throwable cause) {
            future.deliverError(cause);
        }

        @Override
        public boolean isDone() {
            return future.isDone();
        }

        @Override
        public boolean cancel(boolean mayInterruptIfRunning) {
            return future.cancel(mayInterruptIfRunning);
        }
    };

    registerDeliverable(request.getXid(), deliverable);
    this.write(request);
    return future;
}
项目:floodlight-hardware    文件:OFConnection.java   
@Override
public <REPLY extends OFStatsReply> ListenableFuture<List<REPLY>> writeStatsRequest(
        OFStatsRequest<REPLY> request) {
    if (!isConnected()) {
        return Futures.immediateFailedFuture(new SwitchDisconnectedException(getDatapathId()));
    }

    final DeliverableListenableFuture<List<REPLY>> future =
            new DeliverableListenableFuture<List<REPLY>>();

    Deliverable<REPLY> deliverable = new Deliverable<REPLY>() {
        private final List<REPLY> results = Collections
                .synchronizedList(new ArrayList<REPLY>());

        @Override
        public void deliver(REPLY reply) {
            results.add(reply);
            if (!reply.getFlags().contains(OFStatsReplyFlags.REPLY_MORE)) {
                // done
                future.deliver(results);
            }
        }

        @Override
        public void deliverError(Throwable cause) {
            future.deliverError(cause);
        }

        @Override
        public boolean isDone() {
            return future.isDone();
        }

        @Override
        public boolean cancel(boolean mayInterruptIfRunning) {
            return future.cancel(mayInterruptIfRunning);
        }
    };

    registerDeliverable(request.getXid(), deliverable);
    this.write(request);
    return future;
}
项目:ACAMPController    文件:OFConnection.java   
@Override
public <REPLY extends OFStatsReply> ListenableFuture<List<REPLY>> writeStatsRequest(
        OFStatsRequest<REPLY> request) {
    if (!isConnected()) {
        return Futures.immediateFailedFuture(new SwitchDisconnectedException(getDatapathId()));
    }

    final DeliverableListenableFuture<List<REPLY>> future =
            new DeliverableListenableFuture<List<REPLY>>();

    Deliverable<REPLY> deliverable = new Deliverable<REPLY>() {
        private final List<REPLY> results = Collections
                .synchronizedList(new ArrayList<REPLY>());

        @Override
        public void deliver(REPLY reply) {
            results.add(reply);
            if (!reply.getFlags().contains(OFStatsReplyFlags.REPLY_MORE)) {
                // done
                future.deliver(results);
            }
        }

        @Override
        public void deliverError(Throwable cause) {
            future.deliverError(cause);
        }

        @Override
        public boolean isDone() {
            return future.isDone();
        }

        @Override
        public boolean cancel(boolean mayInterruptIfRunning) {
            return future.cancel(mayInterruptIfRunning);
        }
    };

    registerDeliverable(request.getXid(), deliverable);
    this.write(request);
    return future;
}