import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import com.google.common.util.concurrent.FutureCallback;
-
+import edu.umd.cs.findbugs.annotations.Nullable;
import java.util.function.Function;
import org.opendaylight.openflowjava.protocol.api.connection.OutboundQueueException;
final class OutboundQueueEntry {
private static final Logger LOG = LoggerFactory.getLogger(OutboundQueueEntry.class);
- public static final Function<OfHeader, Boolean> DEFAULT_IS_COMPLETE = new Function<OfHeader, Boolean>() {
-
- @Override
- public Boolean apply(final OfHeader message) {
- if (message instanceof MultipartReplyMessage) {
- return !((MultipartReplyMessage) message).getFlags().isOFPMPFREQMORE();
- }
-
- return true;
+ public static final Function<OfHeader, Boolean> DEFAULT_IS_COMPLETE = message -> {
+ if (message instanceof MultipartReplyMessage) {
+ return !((MultipartReplyMessage) message).getFlags().isOFPMPFREQMORE();
}
+ return true;
};
private FutureCallback<OfHeader> callback;
}
private void checkCompletionNeed() {
- if (callback == null || (message instanceof PacketOutInput)) {
+ if (callback == null || message instanceof PacketOutInput) {
completed = true;
if (callback != null) {
callback.onSuccess(null);
}
}
- boolean complete(final OfHeader response) {
+ boolean complete(@Nullable final OfHeader response) {
Preconditions.checkState(!completed, "Attempted to complete a completed message with response %s", response);
// Multipart requests are special, we have to look at them to see
@VisibleForTesting
/** This method is only for testing to prove that after queue entry is completed there is not callback future */
boolean hasCallback() {
- return (callback != null);
+ return callback != null;
}
}