You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/02/05 19:49:40 UTC

[jira] [Commented] (TINKERPOP-1126) A single Host spawns many reconnect tasks

    [ https://issues.apache.org/jira/browse/TINKERPOP-1126?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15134686#comment-15134686 ] 

ASF GitHub Bot commented on TINKERPOP-1126:
-------------------------------------------

GitHub user kieransherlock opened a pull request:

    https://github.com/apache/incubator-tinkerpop/pull/212

    TINKERPOP-1126

    Check the value of reconnectionAttempt and create scheduled task as a 2 step process.
    
    Surely there is a more JDK-1.7 way of doing this, but this is working for me.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/kieransherlock/incubator-tinkerpop TINKERPOP-1126

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-tinkerpop/pull/212.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #212
    
----
commit cced24238fa5a0e3c8f03294e42bac7674faf154
Author: Kieran Sherlock <ki...@identitymind.com>
Date:   2016-02-05T18:44:59Z

    Check the value of reconnectionAttempt and create scheduled task as a 2 step process.
    
    TINKERPOP-1126

----


> A single Host spawns many reconnect tasks
> -----------------------------------------
>
>                 Key: TINKERPOP-1126
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-1126
>             Project: TinkerPop
>          Issue Type: Bug
>          Components: driver
>    Affects Versions: 3.1.0-incubating
>            Reporter: Kieran Sherlock
>            Assignee: stephen mallette
>             Fix For: 3.1.2-incubating
>
>
> While attempting to recover a connection to a gremlin server that has gone offline, the Host object spawns many reconnect tasks
> The following code in Host.makeUnavailable() will always create and schedule a new Runnable no matter the value of reconnectionAttempt 
> {code}
>         reconnectionAttempt.compareAndSet(null,
>                 this.cluster.executor().scheduleAtFixedRate(() -> {
>                             logger.debug("Trying to reconnect to dead host at {}", this);
>                             if (reconnect.apply(this)) reconnected();
>                         }, cluster.connectionPoolSettings().reconnectInitialDelay,
>                         cluster.connectionPoolSettings().reconnectInterval, TimeUnit.MILLISECONDS));
> {code}
> It is just that the ScheduledFuture returned by scheduleAtFixedRate will be ignored if reconnectionAttempt != null.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)