blob: e00bed021f72ac780167bf90f910f1e8049fdc22 [file] [log] [blame]
---
title: Discovering Locators Dynamically
---
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
A background thread periodically queries the locator for any other locators joining the distributed system.
However, if locator A (to which the client is connected) goes down before it discovers locator B, locator B is never discovered even though it is alive and the client receives a `NoLocatorsAvailable` exception.
One connection is attached to every application thread that is `local` to the respective thread. This is known as a thread local connection.
In this case, to perform any cache operation the client is not required to obtain a connection from pool. Instead the thread local connection of the client is used.
A thread local connection can be released by invoking the `Pool::releaseThreadLocalConnection()` method. The released connection is returned to the pool. If the number of threads is larger than the number of `max-connections`, the client throws an `AllConnectionsInUseException` after the `free-connection-timeout` lapses, unless the `Pool::releaseThreadLocalConnection()` method is used judiciously.
If a connection expires or the server goes down on which the connection was established, a thread local connection is immediately replaced with a good connection obtained from the pool.