Skip to content

fixed not to try to reconnect when session and connection timeout.#27

Closed
youngwan657 wants to merge 1 commit into
apache:masterfrom
youngwan657:fixReconnection
Closed

fixed not to try to reconnect when session and connection timeout.#27
youngwan657 wants to merge 1 commit into
apache:masterfrom
youngwan657:fixReconnection

Conversation

@youngwan657
Copy link
Copy Markdown

The application received the zookeeper event without any problems after network is reconnected.

e.g.
RetryPolicy retryPolicy = new ExponentialBackoffRetry(Config.BASE_SLEEP_TIME_MS, 3);
CuratorFrameworkFactory.newClient(connectString, 20000, 10000, retryPolicy);

But following example is not working after network is not available for about 30s.

e.g.
RetryPolicy retryPolicy = new ExponentialBackoffRetry(Config.BASE_SLEEP_TIME_MS, 3);
zkClient = CuratorFrameworkFactory.newClient(connectString, 10000, 10000, retryPolicy);

The application didn't receive any zookeeper event after this reset() method is invoked.

@Randgalt
Copy link
Copy Markdown
Member

I don't understand this. This would break major Curator functionality.

@Randgalt
Copy link
Copy Markdown
Member

Also, what Curator issue does this address?

@asfgit asfgit closed this in dcb44a1 Jul 31, 2014
@youngwan657
Copy link
Copy Markdown
Author

I have a question.
How do I watch the znode again when reconnected after connection and session timeout?
I think the application didn't know RECONNECTED state.
Therefore the application didn't watch any change of the znode after that.

[log]
Connection attempt unsuccessful after 10205 (greater than max timeout of 10000). Resetting connection and trying again with a new connection.
reset
State change: RECONNECTED
There are no ConnectionStateListeners registered.

@Randgalt
Copy link
Copy Markdown
Member

Randgalt commented Aug 1, 2014

Watchers in ZooKeeper are one time only. Once the process() method is called, you need to reset the watch by calling whatever method you used originally. Alternatively, use one of the Curator recipes such as NodeCache.

@youngwan657
Copy link
Copy Markdown
Author

But in this case, process() method wasn't called.
The application didn't detect any event.

That log is curator log not application log.

@Randgalt
Copy link
Copy Markdown
Member

Randgalt commented Aug 1, 2014

You can look at various Curator recipes. Generally, when RECONNECTED is received, Curator recipes reset whatever watchers are needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants