protected against cases where the channels are null and asking for stats

This commit is contained in:
Shay Banon 2011-08-10 17:34:21 +03:00
parent 745b8cbefe
commit 80f9ea5bfe
2 changed files with 4 additions and 2 deletions

View File

@ -257,7 +257,8 @@ public class NettyHttpServerTransport extends AbstractLifecycleComponent<HttpSer
} }
@Override public HttpStats stats() { @Override public HttpStats stats() {
return new HttpStats(serverOpenChannels.numberOfOpenChannels()); OpenChannelsHandler channels = serverOpenChannels;
return new HttpStats(channels == null ? 0 : channels.numberOfOpenChannels());
} }
void dispatchRequest(HttpRequest request, HttpChannel channel) { void dispatchRequest(HttpRequest request, HttpChannel channel) {

View File

@ -443,7 +443,8 @@ public class NettyTransport extends AbstractLifecycleComponent<Transport> implem
} }
@Override public TransportStats stats() { @Override public TransportStats stats() {
return new TransportStats(serverOpenChannels.numberOfOpenChannels()); OpenChannelsHandler channels = serverOpenChannels;
return new TransportStats(channels == null ? 0 : channels.numberOfOpenChannels());
} }
@Override public <T extends Streamable> void sendRequest(final DiscoveryNode node, final long requestId, final String action, final Streamable message, TransportRequestOptions options) throws IOException, TransportException { @Override public <T extends Streamable> void sendRequest(final DiscoveryNode node, final long requestId, final String action, final Streamable message, TransportRequestOptions options) throws IOException, TransportException {