val client: Box[Client] = {
info("Calling client!")
new TransportClient().addTransportAddress(
new InetSocketTransportAddress("192.168.0.100", 9300)
)
}
pretty much just a translation from java to scala. The problem I have
is that is my elastic search instance is down, and I execute the code
above, I get an exception on my logs, something along the lines:
org.elasticsearch.transport.ConnectTransportException:
[][inet[/192.168.0.100:9300]] connect_timeout[30s]
at org.elasticsearch.transport.netty.NettyTransport.connectToChannels(NettyTransport.java:562)
~[elasticsearch-0.18.2.jar:na]
at org.elasticsearch.transport.netty.NettyTransport.connectToNode(NettyTransport.java:505)
~[elasticsearch-0.18.2.jar:na]
at org.elasticsearch.transport.netty.NettyTransport.connectToNode(NettyTransport.java:484)
~[elasticsearch-0.18.2.jar:na]
at org.elasticsearch.transport.TransportService.connectToNode(TransportService.java:124)
~[elasticsearch-0.18.2.jar:na]
at org.elasticsearch.client.transport.TransportClientNodesService$SimpleNodeSampler.sample(TransportClientNodesService.java:262)
~[elasticsearch-0.18.2.jar:na]
at org.elasticsearch.client.transport.TransportClientNodesService$ScheduledNodeSampler.run(TransportClientNodesService.java:245)
[elasticsearch-0.18.2.jar:na]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
[na:1.6.0_25]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
[na:1.6.0_25]
at java.lang.Thread.run(Thread.java:662) [na:1.6.0_25]
Caused by: java.net.ConnectException: Connection refused
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) ~[na:1.6.0_25]
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:567)
~[na:1.6.0_25]
at org.elasticsearch.common.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss.connect(NioClientSocketPipelineSink.java:384)
~[elasticsearch-0.18.2.jar:na]
at org.elasticsearch.common.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss.processSelectedKeys(NioClientSocketPipelineSink.java:354)
~[elasticsearch-0.18.2.jar:na]
at org.elasticsearch.common.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss.run(NioClientSocketPipelineSink.java:276)
~[elasticsearch-0.18.2.jar:na]
at org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
~[elasticsearch-0.18.2.jar:na]
at org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:44)
~[elasticsearch-0.18.2.jar:na]
... 3 common frames omitted
While my app is running I handle this nicely and I show a message on
the browser telling the user what to do, but during unit test (ES is
not running) I want to first check if the port is not listening, and
if that is the case, just not even try to run:
...
.execute()
.actionGet()
Is there an API to do this or should I do it in plain java?
Thanks
Diego
P.S. The integration with Scala and Lift is working out really smooth
val client: Box[Client] = {
info("Calling client!")
new TransportClient().addTransportAddress(
new InetSocketTransportAddress("192.168.0.100", 9300)
)
}
pretty much just a translation from java to scala. The problem I have
is that is my Elasticsearch instance is down, and I execute the code
above, I get an exception on my logs, something along the lines:
org.elasticsearch.transport.ConnectTransportException:
[inet[/192.168.0.100:9300]] connect_timeout[30s]
at
org.elasticsearch.transport.netty.NettyTransport.connectToChannels(NettyTransport.java:562)
~[elasticsearch-0.18.2.jar:na]
at
org.elasticsearch.transport.netty.NettyTransport.connectToNode(NettyTransport.java:505)
~[elasticsearch-0.18.2.jar:na]
at
org.elasticsearch.transport.netty.NettyTransport.connectToNode(NettyTransport.java:484)
~[elasticsearch-0.18.2.jar:na]
at
org.elasticsearch.transport.TransportService.connectToNode(TransportService.java:124)
~[elasticsearch-0.18.2.jar:na]
at
org.elasticsearch.client.transport.TransportClientNodesService$SimpleNodeSampler.sample(TransportClientNodesService.java:262)
~[elasticsearch-0.18.2.jar:na]
at
org.elasticsearch.client.transport.TransportClientNodesService$ScheduledNodeSampler.run(TransportClientNodesService.java:245)
[elasticsearch-0.18.2.jar:na]
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
[na:1.6.0_25]
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
[na:1.6.0_25]
at java.lang.Thread.run(Thread.java:662) [na:1.6.0_25]
Caused by: java.net.ConnectException: Connection refused
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
~[na:1.6.0_25]
at
sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:567)
~[na:1.6.0_25]
at
org.elasticsearch.common.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss.connect(NioClientSocketPipelineSink.java:384)
~[elasticsearch-0.18.2.jar:na]
at
org.elasticsearch.common.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss.processSelectedKeys(NioClientSocketPipelineSink.java:354)
~[elasticsearch-0.18.2.jar:na]
at
org.elasticsearch.common.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss.run(NioClientSocketPipelineSink.java:276)
~[elasticsearch-0.18.2.jar:na]
at
org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
~[elasticsearch-0.18.2.jar:na]
at
org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:44)
~[elasticsearch-0.18.2.jar:na]
... 3 common frames omitted
While my app is running I handle this nicely and I show a message on
the browser telling the user what to do, but during unit test (ES is
not running) I want to first check if the port is not listening, and
if that is the case, just not even try to run:
...
.execute()
.actionGet()
Is there an API to do this or should I do it in plain java?
Thanks
Diego
P.S. The integration with Scala and Lift is working out really smooth
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.