A CacheLoader that loads data from one or more remote
cacheserver processes. This allows for a hierarchical caching
scheme in which one cache ('client' cache) delegates a request to another
cache ('server' cache) when it cannot find the data locally.
When using the BridgeLoader, at least two GemFire Caches must
be running in a client/server mode (they should not be part of the same
distributed system).
The 'server' cache must be running a gemfire cacheserver
process, while the 'client' cache must have a BridgeLoader
installed in one or more of its Regions. If a
BridgeLoader is defined in a client Region,
there must also be a Region defined in the 'server' cache with
the same exact name.

The BridgeLoader performs get() operations on
the remote server cache, and does not provide the distribution behavior that
can be enabled by using a DISTRIBUTED or
DISTRIBUTED_NO_ACKRegion. This mechanism is
designed as a more targeted alternative to netSearch, in which the 'client'
cache completely delegates the loading of the data to the 'server' cache if
it is not yet cached in the client. This directed behavior enables a remote
network get() operation to be performed much more efficiently
in a scenario where there is a hierarchical cache topology. Updates and
invalidation remain local, in fact the Regions that are used
for this loosely coupled cache may even be LOCAL in scope.
The BridgeLoader may be used to configure caches with
multi-layer hierarchies.

Load Balancing:

The BridgeLoader supports these load balancing mechanisms
(specified by the LBPolicy config attribute):

Sticky
In this mode, the client loader picks the first server from the list of
servers and establishes a connection to it. Once this connection has been
established, every request from that particular 'client' cache is sent on
that connection. If requests time out or produce exceptions, the
BridgeLoader picks another server and then sends further
requests to that server. This achieves a level of load balancing by
redirecting requests away from servers that produce timeouts.

RandomSticky
The behavior is the same as Sticky, however the initial assignment of the
connection is randomly selected from the list of servers.

RoundRobin
In this mode, the client establishes connections to all the servers in the
server list and then randomly picks a server for each given request. For the
next request, it picks the next server in the list.

Random :
In this mode, the edge establishes connections to all the servers in the
server list and then randomly picks a server for every request.

Failover:

If a remote server cache throws an exception or times out, the client will
retry based on the configured retryCount parameter. If the
retryCount is exceeded, the server in question will be added
to a failed server list, and the client will select another server to connect
to. The servers in the failed server list will be periodically pinged with an
intelligent ping that ensures cache health. If a server is determined to be
healthy again, it will be promoted back to the healthy server list. The time
period between failed server pings is configurable via the
retryInterval parameter.

Configuration:

The BridgeLoader is configurable declaratively or
programmatically. Declarative configuration is achieved through defining the
configuration parameters in a cache.xml file. Programmatic
configuration may be achieved by first instantiating a
BridgeLoader object and subsequently calling
init(Properties)with a Properties object containing
each desired parameter and value.

The supported parameters are:

endpoints (required)
A comma delimited list of logical names, hostnames, and ports of 'server'
caches to connect to
The endpoints parameter follows this syntax:
logicalName=host:port,logicalName2=host2:port2,....
Example:

readTimeout (optional: default 10000)
A millisecond value representing the amount of time to wait for a response
from a cache server.
Example:

<parameter name="readTimeout">
<string>5000</string>
</parameter>

retryAttempts (optional: default 5)
The number of times to retry a request after timeout/exception.
Example:

<parameter name="retryAttempts">
<string>5</string>
</parameter>

retryInterval (optional: default 10000)
A millisecond value representing the amount of time to wait between attempts
by the ServerMonitor to ping living servers to verify that
they are still alive and dead servers to verify that they are still dead.
Example:

connectionsPerServer (optional: default 1)
The number of initial connections created to each time it is
determined to be alive.
The minimum of 0 causes no initial connections to be created (they are only created on demand).
Example:

If you are using a cache.xml file to create a
Region declaratively, you can include the following
<cache-loader> definition to associate a BridgeLoader
with a Region (default values shown for optional parameters):

close()Deprecated. Called when the region containing this BridgeLoader is
destroyed, when the Cacheis closed, or when a callback is removed
from a region using an AttributesMutator
Closes connections to BridgeServers when all Regions are
finished using this BridgeLoader,

void

detach(Region r)Deprecated. Notify the BridgeLoader that the given region is no longer relevant.

init

Initializes the loader with supplied config parameters. If instantiating
the loader programmatically, this method must be called with a
Properties object that at a minimum contains the 'endpoints'
parameter before the loader can be used. If a LicenseException is thrown
during initialization the BridgeLoader will trhow IllegalStateExceptions
until properly initialized.

loadEmergencyClasses

close

public void close()

Deprecated.

Called when the region containing this BridgeLoader is
destroyed, when the Cacheis closed, or when a callback is removed
from a region using an AttributesMutator
Closes connections to BridgeServers when all Regions are
finished using this BridgeLoader,

isClosed

public boolean isClosed()

Deprecated.

Returns true if this BridgeLoader has been closed.

release

public void release()

Deprecated.

For speed optimizations, a connection to a server may be assigned to the
calling thread when load is called. When the application thread is done
doing its work it should invoke the BridgeLoader close method. This frees
up the connection assigned to the application thread.

terminate

public void terminate()

Deprecated.

This method should be invoked when the BridgeLoader mechanism is to be shut
down explicitly , outside of closing the cache.

load

This method is invoked implicitly when an object requested on the client
cache cannot be found. The server cache will attempt to be contacted, and
if no server cache is available (or healthy) a CacheLoaderException will
be thrown.

helper - a LoaderHelper object that is passed in from cache service
and provides access to the key, region, argument, and netSearch.

Returns:

the value supplied for this key, or null if no value can be
supplied. A local loader will always be invoked if one exists.
Otherwise one remote loader is invoked.
Returning null causes
Region.get(Object, Object) to return null.