GemFire 6.6.4

com.gemstone.gemfire.cache.util
Class BridgeLoader

java.lang.Object
  extended by com.gemstone.gemfire.cache.util.BridgeLoader
All Implemented Interfaces:
CacheCallback, CacheLoader, Declarable

Deprecated. as of 5.7 use pools instead.

@Deprecated
public class BridgeLoader
extends Object
implements CacheLoader, Declarable

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_ACK Region. 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):

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:

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

 
 <cache-loader>
   <class-name>com.gemstone.gemfire.cache.util.BridgeLoader</class-name>
   <parameter name="endpoints">
     <string>MyHost=ninja.gemstone.com:40404</string>
   </parameter>
   <parameter name="readTimeout">
     <string>10000</string>
   </parameter>
   <parameter name="retryAttempts">
     <string>5</string>
   </parameter>
   <parameter name="retryInterval">
     <string>10000</string>
   </parameter>
   <parameter name="LBPolicy">
     <string>Sticky</string>
   </parameter>
   <parameter name="socketBufferSize">
     <string>32768</string>
   </parameter>
   </parameter>
 </cache-loader>
 

Since:
2.0.2

Constructor Summary
BridgeLoader()
          Deprecated.  
BridgeLoader(BridgeWriter bw)
          Deprecated. Creates a loader from an existing BridgeWriter.
 
Method Summary
 void addEndpoint(String name, String host, int port)
          Deprecated. Add an Endpoint to the known Endpoints.
 void attach(Region r)
          Deprecated. Notify the BridgeLoader that the given Region will begin calling load(LoaderHelper).
 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,
 void detach(Region r)
          Deprecated. Notify the BridgeLoader that the given region is no longer relevant.
 Object getConnectionProxy()
          Deprecated. Returns the ConnectionProxy associated with this BridgeLoader.
 String getLBPolicy()
          Deprecated. Returns the load balancing policy being used by the bridge loader Internal use only
 Properties getProperties()
          Deprecated. Returns the properties that defined this BridgeWriter.
 int getReadTimeout()
          Deprecated. Returns the read timeout being used to time out requests to the server Internal use only.
 int getRetryAttempts()
          Deprecated. Returns the number of times the bridge loader tries to get data on encountering certain types of exceptions.
 int getRetryInterval()
          Deprecated. Returns the retry interval in use.
 void init(BridgeLoader bridgeLoader)
          Deprecated. Initializes this loader from an existing BridgeLoader.
 void init(BridgeWriter bridgeWriter)
          Deprecated. Initializes this loader from an existing BridgeWriter.
 void init(Properties p)
          Deprecated. Initializes the loader with supplied config parameters.
 boolean isClosed()
          Deprecated. Returns true if this BridgeLoader has been closed.
 Object load(LoaderHelper helper)
          Deprecated. This method is invoked implicitly when an object requested on the client cache cannot be found.
static void loadEmergencyClasses()
          Deprecated. Ensure that the ConnectionProxyImpl class gets loaded.
 SelectResults query(String queryStr)
          Deprecated. use Region.query(java.lang.String) instead
 void release()
          Deprecated. For speed optimizations, a connection to a server may be assigned to the calling thread when load is called.
 void removeEndpoint(String name, String host, int port)
          Deprecated. Remove an Endpoint from the dead Endpoints.
 void terminate()
          Deprecated. This method should be invoked when the BridgeLoader mechanism is to be shut down explicitly , outside of closing the cache.
 String toString()
          Deprecated. Returns a brief description of this BridgeLoader
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BridgeLoader

public BridgeLoader()
Deprecated. 

BridgeLoader

public BridgeLoader(BridgeWriter bw)
Deprecated. 
Creates a loader from an existing BridgeWriter. This method reuses the existing BridgeWriter's proxy.

Parameters:
bw - The existing BridgeWriter
Since:
5.7
Method Detail

init

public void init(Properties p)
Deprecated. 
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.

Specified by:
init in interface Declarable
Parameters:
p - configuration data such as 'endpoint' definitions
Throws:
IllegalStateException - if the loader is already initialized

init

public void init(BridgeLoader bridgeLoader)
Deprecated. 
Initializes this loader from an existing BridgeLoader. This method reuses the existing BridgeLoader's connections to the server.

Parameters:
bridgeLoader - The existing BridgeLoader
Throws:
IllegalStateException - if the loader is already initialized
Since:
4.2

init

public void init(BridgeWriter bridgeWriter)
Deprecated. 
Initializes this loader from an existing BridgeWriter. This method reuses the existing BridgeWriter's proxy.

Parameters:
bridgeWriter - The existing BridgeWriter
Throws:
IllegalStateException - if the loader is already initialized
Since:
5.7

loadEmergencyClasses

public static void loadEmergencyClasses()
Deprecated. 
Ensure that the ConnectionProxyImpl class gets loaded.

See Also:
SystemFailure.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,

Specified by:
close in interface CacheCallback
See Also:
detach(Region), attach(Region)

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

public Object load(LoaderHelper helper)
            throws CacheLoaderException
Deprecated. 
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.

Specified by:
load in interface CacheLoader
Parameters:
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.
Throws:
CacheLoaderException
See Also:
Region.get

query

@Deprecated
public SelectResults query(String queryStr)
                    throws CacheLoaderException
Deprecated. use Region.query(java.lang.String) instead

Invoke a query on the cache server.

Throws:
CacheLoaderException

getRetryInterval

public int getRetryInterval()
Deprecated. 
Returns the retry interval in use. Retry interval refers to the interval at which dead servers are attempted to be reconnected. Internal use only.


getReadTimeout

public int getReadTimeout()
Deprecated. 
Returns the read timeout being used to time out requests to the server Internal use only.


getRetryAttempts

public int getRetryAttempts()
Deprecated. 
Returns the number of times the bridge loader tries to get data on encountering certain types of exceptions. Internal use only


getLBPolicy

public String getLBPolicy()
Deprecated. 
Returns the load balancing policy being used by the bridge loader Internal use only


getProperties

public Properties getProperties()
Deprecated. 
Returns the properties that defined this BridgeWriter.

Returns:
the properties that defined this BridgeWriter
Since:
4.2

getConnectionProxy

public Object getConnectionProxy()
Deprecated. 
Returns the ConnectionProxy associated with this BridgeLoader. For internal use only.

Returns:
the ConnectionProxy associated with this BridgeLoader

addEndpoint

public void addEndpoint(String name,
                        String host,
                        int port)
                 throws EndpointExistsException
Deprecated. 
Add an Endpoint to the known Endpoints.

Parameters:
name - The name of the endpoint to add
host - The host name or ip address of the endpoint to add
port - The port of the endpoint to add
Throws:
EndpointExistsException - if the Endpoint to be added already exists.
Since:
5.0.2

removeEndpoint

public void removeEndpoint(String name,
                           String host,
                           int port)
                    throws EndpointDoesNotExistException,
                           EndpointInUseException
Deprecated. 
Remove an Endpoint from the dead Endpoints. The specified Endpoint must be dead.

Parameters:
name - The name of the endpoint to remove
host - The host name or ip address of the endpoint to remove
port - The port of the endpoint to remove
Throws:
EndpointDoesNotExistException - if the Endpoint to be removed doesn't exist.
EndpointInUseException - if the Endpoint to be removed contains Connections
Since:
5.0.2

toString

public String toString()
Deprecated. 
Returns a brief description of this BridgeLoader

Overrides:
toString in class Object
Since:
4.0

detach

public void detach(Region r)
Deprecated. 
Notify the BridgeLoader that the given region is no longer relevant. This method is used internally during Region destructionand closure. This method effects the behavor of close().

Parameters:
r - the Region which will no longer use this BridgeLoader
Since:
4.3
See Also:
close(), attach(Region)

attach

public void attach(Region r)
Deprecated. 
Notify the BridgeLoader that the given Region will begin calling load(LoaderHelper). This method affects the behavior of close(). This is called internally when the BridgeLoader is added to a Region via AttributesFactory.setCacheLoader(CacheLoader)

Parameters:
r - the Region which will begin use this BridgeWriter.
Since:
4.3
See Also:
detach(Region), close()

GemFire 6.6.4

Copyright © 1997-2012 VMware, Inc. All rights reserved.