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

Kieran Sherlock edited comment on TINKERPOP-1126 at 2/8/16 6:21 PM:
--------------------------------------------------------------------

I did open a PR for this issue at 
https://github.com/apache/incubator-tinkerpop/pull/213.  I don't know why JIRA 
and github aren't linking them.

In TINKERPOP-1127, Ramzi Oueslati also noted this issue and suggested a 
slightly different fix.  I like that fix better than mine, with one small 
change 

{code}
    private void reconnected() {
-       retryInProgress.set(Boolean.FALSE);
        retryThread.cancel(false);
        retryThread = null;
+      retryInProgress.set(Boolean.FALSE);
        makeAvailable();
    }
{code}


was (Author: kieransherlock):
I did open a PR for this issue at 
https://github.com/apache/incubator-tinkerpop/pull/213.  I don't know why JIRA 
and github aren't linking them.

In TINKERPOP-1127, Ramzi Oueslati, also noted this issue and suggested a 
slightly different fix.  I like that fix better than mine, with one small 
change 

{code}
    private void reconnected() {
-       retryInProgress.set(Boolean.FALSE);
        retryThread.cancel(false);
        retryThread = null;
+      retryInProgress.set(Boolean.FALSE);
        makeAvailable();
    }
{code}

> 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)

Reply via email to