SolarMetric Kodo JDO 2.4.3 generated on March 27 2003

com.solarmetric.kodo.runtime.datacache.plugins
Class SocketDistributedCache

java.lang.Object
  |
  +--com.solarmetric.kodo.runtime.datacache.plugins.LocalCache
        |
        +--com.solarmetric.kodo.runtime.datacache.plugins.DistributedCache
              |
              +--com.solarmetric.kodo.runtime.datacache.plugins.SocketDistributedCache
All Implemented Interfaces:
Configurable, DataCache
Direct Known Subclasses:
TCPCache, UDPCache

public abstract class SocketDistributedCache
extends DistributedCache

A distributed cache implementation that builds up a packet of data containing the change notification. This packet contains information uniquely identifying the transmitting cache, including the machine's IPV4 address and a JVM-unique sequence number. It is up to concrete subclasses of this class to transport the packet to other machines.


Inner Class Summary
protected static class SocketDistributedCache.HostAddress
          Utility class to store an InetAddress and an int.
protected static class SocketDistributedCache.SocketCacheListener
          Responsible for listening for packets and processing the received packets.
 
Fields inherited from class com.solarmetric.kodo.runtime.datacache.plugins.LocalCache
cache
 
Constructor Summary
protected SocketDistributedCache()
           
 
Method Summary
protected  void broadcastUpdate(Map additions, Map updates, Collection deletes)
          Notifys other PersistenceManagerFactory caches in this JVM and on other machines of changes to the cache.
 void endConfiguration()
          Subclasses that need to perform actions in Configurable#endConfiguration must invoke this method.
protected  long getID()
           
protected  byte[] getLocalhost()
           
protected  int getPort()
           
protected abstract  SocketDistributedCache.SocketCacheListener newSocketCacheListener()
          Creates a new SocketCacheListener configured to listen on the appropriate port/protocol for a given SocketDistributedCache implementation.
protected abstract  void sendUpdatePacket(byte[] bytes)
          Sends a change notification packet to other machines in this cache cluster.
 void setPort(int port)
          Sets the port that this cache should listen on.
 void startConfiguration()
          Invoked before configuration is begun on this object
 
Methods inherited from class com.solarmetric.kodo.runtime.datacache.plugins.DistributedCache
batchUpdate, log, log, receivedBatchUpdate
 
Methods inherited from class com.solarmetric.kodo.runtime.datacache.plugins.LocalCache
clear, close, containsKey, get, getCacheMap, getCacheSize, newCacheMap, pin, put, remove, removeAll, setCacheSize, unpin
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SocketDistributedCache

protected SocketDistributedCache()
                          throws UnknownHostException
Method Detail

broadcastUpdate

protected void broadcastUpdate(Map additions,
                               Map updates,
                               Collection deletes)
Description copied from class: DistributedCache
Notifys other PersistenceManagerFactory caches in this JVM and on other machines of changes to the cache.
Overrides:
broadcastUpdate in class DistributedCache

getID

protected long getID()
Returns:
a number for this cache that is unique to this JVM.

getLocalhost

protected byte[] getLocalhost()
Returns:
the cached address of this machine.

getPort

protected int getPort()
Returns:
the port that this cache will listen on.

setPort

public void setPort(int port)
Sets the port that this cache should listen on.

sendUpdatePacket

protected abstract void sendUpdatePacket(byte[] bytes)
                                  throws IOException
Sends a change notification packet to other machines in this cache cluster.

newSocketCacheListener

protected abstract SocketDistributedCache.SocketCacheListener newSocketCacheListener()
                                                                              throws Exception
Creates a new SocketCacheListener configured to listen on the appropriate port/protocol for a given SocketDistributedCache implementation.

startConfiguration

public void startConfiguration()
Description copied from interface: Configurable
Invoked before configuration is begun on this object
Overrides:
startConfiguration in class LocalCache

endConfiguration

public void endConfiguration()
Subclasses that need to perform actions in Configurable#endConfiguration must invoke this method.
Overrides:
endConfiguration in class LocalCache

SolarMetric Kodo JDO 2.4.3 generated on March 27 2003

Copyright 2001,2002 SolarMetric, Inc. All Rights Reserved.