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.

[1]
http://apache-ignite-developers.2346864.n4.nabble.com/Thin-Client-ping-operation-td49181.html

On Sat, Sep 12, 2020 at 9:33 PM Scott Prater <[email protected]> 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 <[email protected]> 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 <[email protected]>
>> 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 <[email protected]> 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
>>>>
>>>>
>>>>
>>>
>>>

Reply via email to