Feature request: method to test active connection in Ignite thin client

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

Feature request: method to test active connection in Ignite thin client

Hello,

I'm a new Ignite user, and with just a little bit of exposure, I'm quite impressed with it -- it did not take me long to get a single standalone remote node up and running and start using it as a durable memory key-value store.

I created a connection pool for ClientCache in Java, using Apache Commons Pool 2.  So far it's working well, but I had to fudge overriding the commons-pool2 "validateObject()" method, which is a method to test that your pooled object is still alive and well:  I used clientCache.getName().equals("MY_CACHE") as a test, but I have no idea if this indicates whether the connection to my remote cache is active or not.

In some future release, could you add a "isConnected()" method or similar to ClientCache or IgniteClient (if it makes more sense there), for ease of testing connections and determining when to discard bad client objects?

thanks,

-- Scott
ptupitsyn ptupitsyn
Reply | Threaded
Open this post in threaded view
|

Re: Feature request: method to test active connection in Ignite thin client

Hello Scott,

ClientCache.getName() is a local operation, it simply returns a cached string.

IgniteClient.cluster().state() is a good way to check the connectivity - 
it sends a lightweight request to the server.

As I understood, you are asking for something like IgniteClient.ping(), right?

Thanks,
Pavel

On Sat, Sep 12, 2020 at 2:25 AM Scott Prater <[hidden email]> wrote:
Hello,

I'm a new Ignite user, and with just a little bit of exposure, I'm quite impressed with it -- it did not take me long to get a single standalone remote node up and running and start using it as a durable memory key-value store.

I created a connection pool for ClientCache in Java, using Apache Commons Pool 2.  So far it's working well, but I had to fudge overriding the commons-pool2 "validateObject()" method, which is a method to test that your pooled object is still alive and well:  I used clientCache.getName().equals("MY_CACHE") as a test, but I have no idea if this indicates whether the connection to my remote cache is active or not.

In some future release, could you add a "isConnected()" method or similar to ClientCache or IgniteClient (if it makes more sense there), for ease of testing connections and determining when to discard bad client objects?

thanks,

-- Scott
Scott Prater Scott Prater
Reply | Threaded
Open this post in threaded view
|

Re: Feature request: method to test active connection in Ignite thin client

Correct, something like a ping.  But the state() method should serve the purpose, too.  Thanks!

On Sat, Sep 12, 2020 at 2:30 AM Pavel Tupitsyn <[hidden email]> wrote:
Hello Scott,

ClientCache.getName() is a local operation, it simply returns a cached string.

IgniteClient.cluster().state() is a good way to check the connectivity - 
it sends a lightweight request to the server.

As I understood, you are asking for something like IgniteClient.ping(), right?

Thanks,
Pavel

On Sat, Sep 12, 2020 at 2:25 AM Scott Prater <[hidden email]> wrote:
Hello,

I'm a new Ignite user, and with just a little bit of exposure, I'm quite impressed with it -- it did not take me long to get a single standalone remote node up and running and start using it as a durable memory key-value store.

I created a connection pool for ClientCache in Java, using Apache Commons Pool 2.  So far it's working well, but I had to fudge overriding the commons-pool2 "validateObject()" method, which is a method to test that your pooled object is still alive and well:  I used clientCache.getName().equals("MY_CACHE") as a test, but I have no idea if this indicates whether the connection to my remote cache is active or not.

In some future release, could you add a "isConnected()" method or similar to ClientCache or IgniteClient (if it makes more sense there), for ease of testing connections and determining when to discard bad client objects?

thanks,

-- Scott




Scott Prater Scott Prater
Reply | Threaded
Open this post in threaded view
|

Re: Feature request: method to test active connection in Ignite thin client

Hello, Pavel --

There isn't a method cluster() in the IgniteClient java class.  I came up with a different workaround:  I retrieve the number of cached entries on the heap, and check that it's greater than -1 and no exception is thrown.  That's not ideal, but should work, as long as ClientCache.size() never returns a negative number.  Ideally I would use something like clientCacheObject.ping(), which would simply send a request to the node or cluster, and get back a response (or not).

-- Scott

On Sat, Sep 12, 2020 at 9:33 AM Scott Prater <[hidden email]> wrote:
Correct, something like a ping.  But the state() method should serve the purpose, too.  Thanks!

On Sat, Sep 12, 2020 at 2:30 AM Pavel Tupitsyn <[hidden email]> wrote:
Hello Scott,

ClientCache.getName() is a local operation, it simply returns a cached string.

IgniteClient.cluster().state() is a good way to check the connectivity - 
it sends a lightweight request to the server.

As I understood, you are asking for something like IgniteClient.ping(), right?

Thanks,
Pavel

On Sat, Sep 12, 2020 at 2:25 AM Scott Prater <[hidden email]> wrote:
Hello,

I'm a new Ignite user, and with just a little bit of exposure, I'm quite impressed with it -- it did not take me long to get a single standalone remote node up and running and start using it as a durable memory key-value store.

I created a connection pool for ClientCache in Java, using Apache Commons Pool 2.  So far it's working well, but I had to fudge overriding the commons-pool2 "validateObject()" method, which is a method to test that your pooled object is still alive and well:  I used clientCache.getName().equals("MY_CACHE") as a test, but I have no idea if this indicates whether the connection to my remote cache is active or not.

In some future release, could you add a "isConnected()" method or similar to ClientCache or IgniteClient (if it makes more sense there), for ease of testing connections and determining when to discard bad client objects?

thanks,

-- Scott




ptupitsyn ptupitsyn
Reply | Threaded
Open this post in threaded view
|

Re: Feature request: method to test active connection in Ignite thin client

Sorry, IgniteClient.cluster() was added for Ignite 2.9, which is not yet released.
ClientCache.size() works too.

I've started a discussion on the dev list [1] regarding a dedicated ping API.


On Sat, Sep 12, 2020 at 9:33 PM Scott Prater <[hidden email]> wrote:
Hello, Pavel --

There isn't a method cluster() in the IgniteClient java class.  I came up with a different workaround:  I retrieve the number of cached entries on the heap, and check that it's greater than -1 and no exception is thrown.  That's not ideal, but should work, as long as ClientCache.size() never returns a negative number.  Ideally I would use something like clientCacheObject.ping(), which would simply send a request to the node or cluster, and get back a response (or not).

-- Scott

On Sat, Sep 12, 2020 at 9:33 AM Scott Prater <[hidden email]> wrote:
Correct, something like a ping.  But the state() method should serve the purpose, too.  Thanks!

On Sat, Sep 12, 2020 at 2:30 AM Pavel Tupitsyn <[hidden email]> wrote:
Hello Scott,

ClientCache.getName() is a local operation, it simply returns a cached string.

IgniteClient.cluster().state() is a good way to check the connectivity - 
it sends a lightweight request to the server.

As I understood, you are asking for something like IgniteClient.ping(), right?

Thanks,
Pavel

On Sat, Sep 12, 2020 at 2:25 AM Scott Prater <[hidden email]> wrote:
Hello,

I'm a new Ignite user, and with just a little bit of exposure, I'm quite impressed with it -- it did not take me long to get a single standalone remote node up and running and start using it as a durable memory key-value store.

I created a connection pool for ClientCache in Java, using Apache Commons Pool 2.  So far it's working well, but I had to fudge overriding the commons-pool2 "validateObject()" method, which is a method to test that your pooled object is still alive and well:  I used clientCache.getName().equals("MY_CACHE") as a test, but I have no idea if this indicates whether the connection to my remote cache is active or not.

In some future release, could you add a "isConnected()" method or similar to ClientCache or IgniteClient (if it makes more sense there), for ease of testing connections and determining when to discard bad client objects?

thanks,

-- Scott




Scott Prater Scott Prater
Reply | Threaded
Open this post in threaded view
|

Re: Feature request: method to test active connection in Ignite thin client

Thanks, Pavel.  I'll follow the discussion there.

On Sun, Sep 13, 2020 at 5:27 AM Pavel Tupitsyn <[hidden email]> wrote:
Sorry, IgniteClient.cluster() was added for Ignite 2.9, which is not yet released.
ClientCache.size() works too.

I've started a discussion on the dev list [1] regarding a dedicated ping API.


On Sat, Sep 12, 2020 at 9:33 PM Scott Prater <[hidden email]> wrote:
Hello, Pavel --

There isn't a method cluster() in the IgniteClient java class.  I came up with a different workaround:  I retrieve the number of cached entries on the heap, and check that it's greater than -1 and no exception is thrown.  That's not ideal, but should work, as long as ClientCache.size() never returns a negative number.  Ideally I would use something like clientCacheObject.ping(), which would simply send a request to the node or cluster, and get back a response (or not).

-- Scott

On Sat, Sep 12, 2020 at 9:33 AM Scott Prater <[hidden email]> wrote:
Correct, something like a ping.  But the state() method should serve the purpose, too.  Thanks!

On Sat, Sep 12, 2020 at 2:30 AM Pavel Tupitsyn <[hidden email]> wrote:
Hello Scott,

ClientCache.getName() is a local operation, it simply returns a cached string.

IgniteClient.cluster().state() is a good way to check the connectivity - 
it sends a lightweight request to the server.

As I understood, you are asking for something like IgniteClient.ping(), right?

Thanks,
Pavel

On Sat, Sep 12, 2020 at 2:25 AM Scott Prater <[hidden email]> wrote:
Hello,

I'm a new Ignite user, and with just a little bit of exposure, I'm quite impressed with it -- it did not take me long to get a single standalone remote node up and running and start using it as a durable memory key-value store.

I created a connection pool for ClientCache in Java, using Apache Commons Pool 2.  So far it's working well, but I had to fudge overriding the commons-pool2 "validateObject()" method, which is a method to test that your pooled object is still alive and well:  I used clientCache.getName().equals("MY_CACHE") as a test, but I have no idea if this indicates whether the connection to my remote cache is active or not.

In some future release, could you add a "isConnected()" method or similar to ClientCache or IgniteClient (if it makes more sense there), for ease of testing connections and determining when to discard bad client objects?

thanks,

-- Scott