initialize the transport adapter on creation so asking for stats will not NPE

This commit is contained in:
Shay Banon 2011-09-01 19:18:28 +03:00
parent 3ae40487b6
commit 87049d0d29
1 changed files with 3 additions and 3 deletions

View File

@ -70,7 +70,7 @@ public class TransportService extends AbstractLifecycleComponent<TransportServic
}); });
private boolean throwConnectException = false; private boolean throwConnectException = false;
private TransportService.Adapter adapter; private final TransportService.Adapter adapter = new Adapter();
public TransportService(Transport transport, ThreadPool threadPool) { public TransportService(Transport transport, ThreadPool threadPool) {
this(EMPTY_SETTINGS, transport, threadPool); this(EMPTY_SETTINGS, transport, threadPool);
@ -83,8 +83,8 @@ public class TransportService extends AbstractLifecycleComponent<TransportServic
} }
@Override protected void doStart() throws ElasticSearchException { @Override protected void doStart() throws ElasticSearchException {
// register us as an adapter for the transport service adapter.rxMetric.clear();
adapter = new Adapter(); adapter.txMetric.clear();
transport.transportServiceAdapter(adapter); transport.transportServiceAdapter(adapter);
transport.start(); transport.start();
if (transport.boundAddress() != null && logger.isInfoEnabled()) { if (transport.boundAddress() != null && logger.isInfoEnabled()) {