ignite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Semyon Boikov <sboi...@gridgain.com>
Subject Re: Finished IGNITE-901
Date Tue, 21 Jul 2015 21:11:25 GMT
Added documentation about client reconnect in the 'Clients vs Servers'
section: http://apacheignite.readme.io/docs/clients-vs-servers.

On Thu, Jul 16, 2015 at 2:29 PM, Semyon Boikov <sboikov@gridgain.com> wrote:

> Hi,
>
> I finished work on 'client reconnect' feature (
> https://issues.apache.org/jira/browse/IGNITE-901), it is merged into
> master. Here is brief description of this feature:
>
> Client node can disconnect from cluster in several cases:
> - in case of network problems when client can not re-establish connection
> with server
> - connection with server was broken for some time, client is able to
> re-establish connection with server, but server already dropped client node
> since did not receive client heartbeats
> - slow clients can be dropped by server (see
> TcpCommunicationSpi.slowClientQueueLimit)
>
> Before changes done in ignite-901 in case of disconnection client node was
> just stopped.
>
> Now client assigns to a local node new ID and tries to reconnect to
> cluster. Note: this has side effect and 'id' property of local ClusterNode
> will change in case of client reconnection.
> While client tries to reconnect to cluster all Ignite API throws special
> exception: IgniteClientDisconnectedException, this exception provides
> future which will be completed when client finish reconnect (IgniteCache
> API throws CacheException which has IgniteClientDisconnectedException as
> its cause).
>
> After client reconnected Ignite API can be used again.
>
> Also we added special discovery events
> (EventType.EVT_CLIENT_NODE_DISCONNECTED,
> EventType.EVT_CLIENT_NODE_RECONNECTED) and method on IgniteCluster to get
> client reconnect future.
>
> New reconnect behavior can be disabled using 'clientReconnectDisabled'
> property on TcpDiscoverySpi.
>
> And here is an example how work with disconnected exception looks like:
>
> *    IgniteCache cache = ignite.getOrCreateCache(new
> CacheConfiguration<>());*
>
> *    while (true) {*
> *        try {*
> *            cache.put(key, val);*
> *        }*
> *        catch (CacheException e) {*
> *            if (e.getCause() instanceof
> IgniteClientDisconnectedException) {*
> *                IgniteClientDisconnectedException cause =
> (IgniteClientDisconnectedException)e.getCause();*
>
> *                cause.reconnectFuture().get();*
>
> *                // Client reconnected, can proceed and use the same cache
> instance.*
> *            }*
> *        }*
> *    }*
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message