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