SolarMetric Kodo JDO 2.5.0 Reverse Schema Tool

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

java.lang.Object
  |
  +--com.solarmetric.rd.kodo.runtime.datacache.plugins.LocalCache
        |
        +--com.solarmetric.rd.kodo.runtime.datacache.plugins.DistributedCache
              |
              +--com.solarmetric.rd.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.


Nested 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.
 
Field Summary
 
Fields inherited from class com.solarmetric.rd.kodo.runtime.datacache.plugins.LocalCache
cache
 
Constructor Summary
protected SocketDistributedCache()
           
 
Method Summary
protected  void broadcastUpdate(java.util.Map additions, java.util.Map updates, java.util.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.rd.kodo.runtime.datacache.plugins.DistributedCache
batchUpdate, log, log, receivedBatchUpdate
 
Methods inherited from class com.solarmetric.rd.kodo.runtime.datacache.plugins.LocalCache
clear, close, 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 java.net.UnknownHostException
Method Detail

broadcastUpdate

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

Specified by:
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 java.io.IOException
Sends a change notification packet to other machines in this cache cluster.

java.io.IOException

newSocketCacheListener

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

java.lang.Exception

startConfiguration

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

Specified by:
startConfiguration in interface Configurable
Overrides:
startConfiguration in class LocalCache

endConfiguration

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

Specified by:
endConfiguration in interface Configurable
Overrides:
endConfiguration in class LocalCache

SolarMetric Kodo JDO 2.5.0 Reverse Schema Tool

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