|
Oracle® Fusion Middleware Java API Reference for Oracle Coherence 12c (12.1.2) E26043-01 |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object
com.tangosol.util.Base
com.tangosol.net.RefreshableAddressProvider
public abstract class RefreshableAddressProvider
A RefreshableAddressProvider is an abstract AddressProvider implementation that maintains a nearly up-to-date cache of Addresses that is periodically asynchronously refreshed. This ensures that the behaviour of this AddressProvider will be performant (specifically non-blocking).
Implementing subclasses should provide implementation logic for deciding how and when the address cache should be refreshed. That logic must reside in getNextAddressInternal() instead of getNextAddress().
Note: subclasses must call initialize() before the AddressProvider is used.
| Nested Class Summary | |
|---|---|
protected class |
RefreshableAddressProvider.RefreshThread |
| Field Summary | |
|---|---|
protected Daemon |
m_daemonRefreshThe refresh daemon. |
protected java.util.Iterator |
m_iteratorThe iterator used to implement the AddressProvider interface. |
protected java.util.List |
m_listCacheThe cached addresses. |
static long |
REFRESH_DEFAULTDefault refresh time of 10 seconds. |
| Constructor Summary | |
|---|---|
RefreshableAddressProvider()Default constructor. |
|
RefreshableAddressProvider(long lRefresh)Construct a RefreshableAddressProvider with the specified refresh interval. |
|
| Method Summary | |
|---|---|
void |
accept()This method should be called by the client immediately after it determines that it can successfully use an address returned by the SocketAddressProvider.getNextAddress() method. |
protected java.util.Iterator |
ensureIterator()Return the cache iterator. |
boolean |
equals(java.lang.Object o)SocketAddressProvider instances are considered equivalent iff they consistently produce the same resulting set of addresses. |
protected void |
finalize()Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. |
java.net.InetSocketAddress |
getNextAddress()Covariant of SocketAddressProvider.getNextAddress() which returns an InetSocketAddress. |
protected abstract java.net.InetSocketAddress |
getNextAddressInternal()Obtain the next available address to use. |
int |
hashCode()Return the hash code for this SocketAddressProvider. |
protected void |
initialize()Initialize the RefreshableAddressProvider and prepare it for use by populating the address-list cache and starting the refresh thread. |
protected void |
instantiateRefreshThread(long lRefresh)Start the refresh thread. |
protected abstract boolean |
isExpired()Check if the cached address list should be refreshed. |
protected void |
refreshAddressList()Refresh the cached address list using the underlying provider. |
void |
reject(java.lang.Throwable eCause)This method should be called by the client immediately after it determines that an attempt to use an address returned by the SocketAddressProvider.getNextAddress() method has failed. |
| Field Detail |
|---|
public static final long REFRESH_DEFAULT
protected volatile java.util.List m_listCache
protected java.util.Iterator m_iterator
protected Daemon m_daemonRefresh
| Constructor Detail |
|---|
public RefreshableAddressProvider()
public RefreshableAddressProvider(long lRefresh)
lRefresh - the refresh interval| Method Detail |
|---|
protected void initialize()
protected abstract java.net.InetSocketAddress getNextAddressInternal()
protected abstract boolean isExpired()
public boolean equals(java.lang.Object o)
Note: the general contract of hashCode and equals() should be preserved; AddressProviders that are "equal" should produce the same hashCode.
equals in interface SocketAddressProvidero - the Object to compare this SocketAddressProvider to for equalitypublic int hashCode()
hashCode in interface SocketAddressProviderprotected void finalize()
public final java.net.InetSocketAddress getNextAddress()
SocketAddressProvider.getNextAddress() which returns an InetSocketAddress.getNextAddress in interface AddressProvidergetNextAddress in interface SocketAddressProviderpublic final void accept()
SocketAddressProvider.getNextAddress() method.accept in interface SocketAddressProviderpublic final void reject(java.lang.Throwable eCause)
SocketAddressProvider.getNextAddress() method has failed.reject in interface SocketAddressProvidereCause - (optional) an exception that carries the reason why the the caller rejected the previously returned addressprotected void refreshAddressList()
protected void instantiateRefreshThread(long lRefresh)
protected java.util.Iterator ensureIterator()
|
Oracle® Fusion Middleware Java API Reference for Oracle Coherence 12c (12.1.2) E26043-01 |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||