InetSocketAddress is not serializable when building ElasticSearch2 connector

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

InetSocketAddress is not serializable when building ElasticSearch2 connector

Hung
This post was updated on .
Hi,

I'm building the connector for ElasticSearch2. One main issue for me now is that

List<TransportAddress> transports = new ArrayList<TransportAddress>();
transports.add(new InetSocketTransportAddress(new InetSocketAddress(TransportAddress, 9300)));

throws
java.io.NotSerializableException: org.elasticsearch.common.transport.InetSocketTransportAddress

ES2 changed to this way and InetSocketAddress implements java.io.Serializable rather than Writable (is it the problem?).
What would be the suggested way to handle this? should I implement a serializable InetSocketAddress?

Best,

Sendoh
Reply | Threaded
Open this post in threaded view
|

Re: InetSocketAddress is not serializable

Zach Cox
I ran into the same issue upgrading to Elasticsearch 2, here's how I solved it:


-Zach


On Fri, Mar 4, 2016 at 7:30 AM HungChang <[hidden email]> wrote:
Hi,

I'm building the connector for ElasticSearch2. One main issue for me now is
that

List<TransportAddress> transports = new ArrayList<TransportAddress>();
transports.add(new InetSocketTransportAddress(new
InetSocketAddress(TransportAddress, 9300)));

throws
java.io.NotSerializableException:
org.elasticsearch.common.transport.InetSocketTransportAddress

ES2 changed to this way and InetSocketAddress implements
java.io.Serializable rather than Writable (is it the problem?).
What would be the suggested way to handle this? should I implement a
serializable InetSocketAddress?

Best,

Sendoh



--
View this message in context: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/InetSocketAddress-is-not-serializable-tp5296.html
Sent from the Apache Flink User Mailing List archive. mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: InetSocketAddress is not serializable

Hung
Thank you. Very nice usage and It works!
Reply | Threaded
Open this post in threaded view
|

Re: InetSocketAddress is not serializable

Hung
Can I ask why List<InetSocketAddress> can become serilizable?

Best,

Sendoh
Reply | Threaded
Open this post in threaded view
|

Re: InetSocketAddress is not serializable

Zach Cox
java.net.InetSocketAddress is Serializable [1] and implementations of java.util.List (e.g. java.util.ArrayList [2]) are also usually Serializable.


On Fri, Mar 4, 2016 at 8:39 AM HungChang <[hidden email]> wrote:
Can I ask why List<InetSocketAddress> can become serilizable?

Best,

Sendoh



--
View this message in context: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/InetSocketAddress-is-not-serializable-when-building-ElasticSearch2-connector-tp5296p5299.html
Sent from the Apache Flink User Mailing List archive. mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: InetSocketAddress is not serializable

Hung
This post was updated on .
Thank you for your explanation. (Misunderstood at first) Yea you avoid passing InetSocketTransportAddress