net.sf.ehcache.distribution.jgroups
Class JGroupsCachePeer

java.lang.Object
  extended by net.sf.ehcache.distribution.jgroups.JGroupsCachePeer
All Implemented Interfaces:
Remote, net.sf.ehcache.distribution.CachePeer

public class JGroupsCachePeer
extends Object
implements net.sf.ehcache.distribution.CachePeer

Handles CachePeerfunctions around a JGroups Channel and a CacheManager

Version:
$Revision$
Author:
Eric Dalquist

Constructor Summary
JGroupsCachePeer(org.jgroups.Channel channel, String clusterName)
          Create a new CachePeer
 
Method Summary
 void dispose()
          Shutdown the cache peer
 List getElements(List keys)
          
 List<org.jgroups.Address> getGroupMembership()
           
 String getGuid()
          
 List<?> getKeys()
          
 org.jgroups.Address getLocalAddress()
           
 String getName()
          
 List<org.jgroups.Address> getOtherGroupMembers()
           
 net.sf.ehcache.Element getQuiet(Serializable key)
          
 String getUrl()
          
 String getUrlBase()
          
 void put(net.sf.ehcache.Element element)
          
 boolean remove(Serializable key)
          
 void removeAll()
          
 void send(org.jgroups.Address dest, List<JGroupEventMessage> eventMessages)
          Sends a list of JGroupEventMessages to the specified address, if no address is set the messages are sent to the entire group.
 void send(List eventMessages)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JGroupsCachePeer

public JGroupsCachePeer(org.jgroups.Channel channel,
                        String clusterName)
Create a new CachePeer

Method Detail

send

public void send(List eventMessages)
          throws RemoteException

Specified by:
send in interface net.sf.ehcache.distribution.CachePeer
Throws:
RemoteException

getGroupMembership

public List<org.jgroups.Address> getGroupMembership()
Returns:
Get the address of all members in the cluster

getOtherGroupMembers

public List<org.jgroups.Address> getOtherGroupMembers()
Returns:
Get the address of all members in the cluster other than this one

getLocalAddress

public org.jgroups.Address getLocalAddress()
Returns:
Get the address of this machine in the cluster

dispose

public void dispose()
Shutdown the cache peer


send

public void send(org.jgroups.Address dest,
                 List<JGroupEventMessage> eventMessages)
Sends a list of JGroupEventMessages to the specified address, if no address is set the messages are sent to the entire group.


getElements

public List getElements(List keys)
                 throws RemoteException

Specified by:
getElements in interface net.sf.ehcache.distribution.CachePeer
Throws:
RemoteException

getGuid

public String getGuid()
               throws RemoteException

Specified by:
getGuid in interface net.sf.ehcache.distribution.CachePeer
Throws:
RemoteException

getKeys

public List<?> getKeys()
                throws RemoteException

Specified by:
getKeys in interface net.sf.ehcache.distribution.CachePeer
Throws:
RemoteException

getName

public String getName()
               throws RemoteException

Specified by:
getName in interface net.sf.ehcache.distribution.CachePeer
Throws:
RemoteException

getQuiet

public net.sf.ehcache.Element getQuiet(Serializable key)
                                throws RemoteException

Specified by:
getQuiet in interface net.sf.ehcache.distribution.CachePeer
Throws:
RemoteException

getUrl

public String getUrl()
              throws RemoteException

Specified by:
getUrl in interface net.sf.ehcache.distribution.CachePeer
Throws:
RemoteException

getUrlBase

public String getUrlBase()
                  throws RemoteException

Specified by:
getUrlBase in interface net.sf.ehcache.distribution.CachePeer
Throws:
RemoteException

put

public void put(net.sf.ehcache.Element element)
         throws IllegalArgumentException,
                IllegalStateException,
                RemoteException

Specified by:
put in interface net.sf.ehcache.distribution.CachePeer
Throws:
IllegalArgumentException
IllegalStateException
RemoteException

remove

public boolean remove(Serializable key)
               throws IllegalStateException,
                      RemoteException

Specified by:
remove in interface net.sf.ehcache.distribution.CachePeer
Throws:
IllegalStateException
RemoteException

removeAll

public void removeAll()
               throws RemoteException,
                      IllegalStateException

Specified by:
removeAll in interface net.sf.ehcache.distribution.CachePeer
Throws:
RemoteException
IllegalStateException


Copyright © 2003-2012 Terracotta, Inc.. All Rights Reserved.