package org.opendaylight.openflowjava.protocol.impl.core.connection;
+import com.google.common.base.Preconditions;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelHandlerContext;
import io.netty.util.concurrent.EventExecutor;
import io.netty.util.concurrent.Future;
import io.netty.util.concurrent.GenericFutureListener;
-
import java.net.InetSocketAddress;
import java.util.Queue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.google.common.base.Preconditions;
-
/**
* Channel handler which bypasses wraps on top of normal Netty pipeline, allowing
* writes to be enqueued from any thread, it then schedules a task pipeline task,
return true;
}
- LOG.trace("Message queue is full");
+ LOG.debug("Message queue is full");
return false;
}
* uncontended.
*/
private synchronized void flush() {
+
final long start = System.nanoTime();
final long deadline = start + maxWorkTime;
}
final GenericFutureListener<Future<Void>> l = h.takeListener();
-
+
final ChannelFuture p;
if (address == null) {
p = channel.write(new MessageListenerWrapper(h.takeMessage(), l));
channel.flush();
}
- final long stop = System.nanoTime();
- LOG.debug("Flushed {} messages in {}us to channel {}",
+ if (LOG.isDebugEnabled()) {
+ final long stop = System.nanoTime();
+ LOG.debug("Flushed {} messages in {}us to channel {}",
messages, TimeUnit.NANOSECONDS.toMicros(stop - start), channel);
+ }
/*
* We are almost ready to terminate. This is a bit tricky, because
}
private void conditionalFlush(final ChannelHandlerContext ctx) {
- Preconditions.checkState(ctx.channel() == channel, "Inconsistent channel %s with context %s", channel, ctx);
+ Preconditions.checkState(ctx.channel().equals(channel), "Inconsistent channel %s with context %s", channel, ctx);
conditionalFlush();
}