Gemfire JavaDocs_test
Package org.apache.geode.cache.util
Class StringPrefixPartitionResolver
- java.lang.Object
-
- org.apache.geode.cache.util.StringPrefixPartitionResolver
-
- All Implemented Interfaces:
CacheCallback
,Declarable
,PartitionResolver<java.lang.String,java.lang.Object>
public class StringPrefixPartitionResolver extends java.lang.Object implements PartitionResolver<java.lang.String,java.lang.Object>
This partition resolver requires every key of the partitioned region to be an instance of String and to contain at least one "|" delimiter. The prefix, the substring of the key that precedes the first delimiter, is returned by getRoutingObject.- Since:
- Geode 1.2.0
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEFAULT_DELIMITER
The default delimiter is "|".
-
Constructor Summary
Constructors Constructor Description StringPrefixPartitionResolver()
Creates a prefix resolver with the default delimiter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Called when the region containing this callback is closed or destroyed, when the cache is closed, or when a callback is removed from a region using anAttributesMutator
.boolean
equals(java.lang.Object o)
java.lang.String
getName()
Returns the name of the PartitionResolverjava.lang.Object
getRoutingObject(EntryOperation<java.lang.String,java.lang.Object> opDetails)
Returns the prefix of the String key that precedes the first "|" in the key.int
hashCode()
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.geode.cache.Declarable
init, initialize
-
-
-
-
Field Detail
-
DEFAULT_DELIMITER
public static final java.lang.String DEFAULT_DELIMITER
The default delimiter is "|". Currently this class only uses the default delimiter but in a future release configuring the delimiter may be supported.- See Also:
- Constant Field Values
-
-
Method Detail
-
getRoutingObject
public java.lang.Object getRoutingObject(EntryOperation<java.lang.String,java.lang.Object> opDetails)
Returns the prefix of the String key that precedes the first "|" in the key.- Specified by:
getRoutingObject
in interfacePartitionResolver<java.lang.String,java.lang.Object>
- Parameters:
opDetails
- the detail of the entry operation e.g.Region.get(Object)
- Returns:
- object associated with entry operation which allows the Partitioned Region to store associated data together
- Throws:
java.lang.ClassCastException
- if the key is not an instance of Stringjava.lang.IllegalArgumentException
- if the key does not contain at least one "|".
-
getName
public java.lang.String getName()
Description copied from interface:PartitionResolver
Returns the name of the PartitionResolver- Specified by:
getName
in interfacePartitionResolver<java.lang.String,java.lang.Object>
- Returns:
- String name
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
close
public void close()
Description copied from interface:CacheCallback
Called when the region containing this callback is closed or destroyed, when the cache is closed, or when a callback is removed from a region using anAttributesMutator
.Implementations should cleanup any external resources such as database connections. Any runtime exceptions this method throws will be logged.
It is possible for this method to be called multiple times on a single callback instance, so implementations must be tolerant of this.
- Specified by:
close
in interfaceCacheCallback
- See Also:
RegionService.close()
,Region.close()
,Region.localDestroyRegion()
,Region.destroyRegion()
,AttributesMutator
-
-