org.cruxframework.crux.core.server.rest.state
Class ClusteredResourceStateHandler

java.lang.Object
  extended by org.cruxframework.crux.core.server.rest.state.ClusteredResourceStateHandler
All Implemented Interfaces:
ResourceStateHandler

public class ClusteredResourceStateHandler
extends Object
implements ResourceStateHandler

It is a very basic implementation of ResourceStateHandler interface for clustered environments. This implementation is based on JGroups ReplCache component and can be used as basis for most complete implementations on top of more powerful cache systems, like Infinispan, EhCache, OsCache, JCS or any other Cache system you prefer. If you choose to use this implementation, you must include jgroups.jar on your classpath. To configure the cache, you can create a file named ClusteredCacheConfig.properties and configure the following properties: channelConfigPropertyFile - JGroups channel config file name rpcTimeout - Timeout for replCache rpc calls useL1Cache - To enable or disable L1 Cache l1ReapingInterval - If L1 cache is enabled, the interval to run the Expired Values Cleaner Thread for L1 Cache l1MaxNumberOfEntries - If L1 cache is enabled, the max number of entries for L1 Cache l2ReapingInterval - The interval to run the Expired Values Cleaner Thread for L2 Cache l1MaxNumberOfEntries - The max number of entries for L2 Cache clusterName - The name of the cluster to be used by this cache replCount - The number of nodes in cluster where the information will be replicated

Author:
Thiago da Rosa de Bustamante

Nested Class Summary
static class ClusteredResourceStateHandler.CacheEntry
           
 
Nested classes/interfaces inherited from interface org.cruxframework.crux.core.server.rest.state.ResourceStateHandler
ResourceStateHandler.ResourceState
 
Constructor Summary
ClusteredResourceStateHandler()
           
 
Method Summary
 ResourceStateHandler.ResourceState add(String uri, long dateModified, long expires, String etag)
          Add state information about one rest URI
 void clear()
          Clear all state information from rest URIs
 ResourceStateHandler.ResourceState get(String uri)
          Retrieve state information about one rest URI
 void remove(String uri)
          Clear the state information about one rest URI
 void removeSegments(String... baseURIs)
          Clear the state information about any rest URI that starts with one of the baseURIs provided
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClusteredResourceStateHandler

public ClusteredResourceStateHandler()
Method Detail

add

public ResourceStateHandler.ResourceState add(String uri,
                                              long dateModified,
                                              long expires,
                                              String etag)
Description copied from interface: ResourceStateHandler
Add state information about one rest URI

Specified by:
add in interface ResourceStateHandler
Returns:

get

public ResourceStateHandler.ResourceState get(String uri)
Description copied from interface: ResourceStateHandler
Retrieve state information about one rest URI

Specified by:
get in interface ResourceStateHandler
Returns:

remove

public void remove(String uri)
Description copied from interface: ResourceStateHandler
Clear the state information about one rest URI

Specified by:
remove in interface ResourceStateHandler

removeSegments

public void removeSegments(String... baseURIs)
Description copied from interface: ResourceStateHandler
Clear the state information about any rest URI that starts with one of the baseURIs provided

Specified by:
removeSegments in interface ResourceStateHandler

clear

public void clear()
Description copied from interface: ResourceStateHandler
Clear all state information from rest URIs

Specified by:
clear in interface ResourceStateHandler


Copyright © 2015. All rights reserved.