public class TxUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
protected static String |
createCallbackPrefix |
protected static String |
destroyCallbackPrefix |
protected static String |
invalidateCallbackPrefix |
protected boolean |
isBridgeClient |
protected boolean |
isSerialExecution |
protected int |
maxKeys |
protected static String |
memberIdString |
int |
modValInitializer |
static int |
NO_REPLICATION |
static int |
NO_REPLICATION_RESTRICTION |
RandomValues |
randomValues |
protected static String |
regionDestroyCallbackPrefix |
protected static String |
regionInvalidateCallbackPrefix |
boolean |
suspendResume |
protected HydraThreadLocal |
txState |
static TxUtil |
txUtilInstance |
protected static String |
updateCallbackPrefix |
| Constructor and Description |
|---|
TxUtil() |
| Modifier and Type | Method and Description |
|---|---|
void |
clearDestroyedRegions()
Clear destroyed regions from the blackboard.
|
Operation |
closeCache()
Closes the cache.
|
boolean |
containsKey(com.gemstone.gemfire.cache.Region aRegion,
Object key)
Call containsKey on the given region and key using suspend and resume.
|
Operation |
containsKeyExisting(com.gemstone.gemfire.cache.Region aRegion)
Does a containsKey in aRegion with a key existing in aRegion.
|
Operation |
containsValueExisting(com.gemstone.gemfire.cache.Region aRegion)
Does a containsValue in aRegion with a key existing in aRegion.
|
Operation |
containsValueForKeyExisting(com.gemstone.gemfire.cache.Region aRegion)
Does a containsValueForKey in aRegion with a key existing in aRegion.
|
void |
createAllDestroyedRegions(boolean fill)
Creates all regions that currently don't exist.
|
void |
createDestroyedRegionsFromBB(boolean fill)
Creates all regions previously destroyed that were recorded in the
TxBB shared map entry TxBB.DestroyedRegionsKey.
|
void |
createEntries(com.gemstone.gemfire.cache.Region aRegion)
Create TxPrms.maxKeys entries in the given region
Initializes ValueHolder.modVal sequentially 1-n
across all regions
|
Operation |
createEntry(com.gemstone.gemfire.cache.Region aRegion,
boolean exists)
Does a creates for a key.
|
void |
createPartitionedRegions() |
Operation |
createRegion()
Creates a region that was previously destroyed.
|
void |
createRegionHierarchy()
Create a forest of regions based on numRootRegions,
numSubRegions, regionDepth
|
Object[] |
createRegionWithPath(String regionName,
boolean fill)
Given a region name, return the region instance for it.
|
Operation |
destroyEntry(boolean isLocalDestroy,
com.gemstone.gemfire.cache.Region aRegion,
Object key,
boolean entryNotFoundExcOK)
Destroys an entry in aRegion.
|
Operation |
destroyRegion(boolean isLocalDestroy,
com.gemstone.gemfire.cache.Region aRegion)
Destroys the given region.
|
void |
dispAllKeys()
Method to traverse tree & display all keys
|
OpList |
doNonrepeatableReadOperations(int numOperationsToDo)
Do random non-repeatable read operations on random regions.
|
static OpList |
doOperations()
Do random operations on random regions using the hydra parameter
TxPrms.operations as the list of available operations and
TxPrms.numOps as the number of operations to do.
|
static OpList |
doOperations(boolean allowGetOperations)
Do random operations on random regions using the hydra parameter
TxPrms.operations as the list of available operations and
TxPrms.numOps as the number of operations to do.
|
OpList |
doOperations(Vector operations,
int numOperationsToDo)
Do random operations on random regions.
|
OpList |
doOperations(Vector operations,
int numOperationsToDo,
boolean allowGetOperations)
Do random operations on random regions.
|
OpList |
doRepeatableReadOperations(int numOperationsToDo)
Do random repeatable read operations on random regions.
|
Operation |
getAll(com.gemstone.gemfire.cache.Region r) |
Operation |
getEntry(com.gemstone.gemfire.cache.Region aRegion,
Object key,
String opName)
Does a get with the given key.
|
Operation |
getEntryWithExistingKey(com.gemstone.gemfire.cache.Region aRegion)
Does a getEntry in aRegion with a key existing in aRegion.
|
Operation |
getEntryWithNewKey(com.gemstone.gemfire.cache.Region aRegion)
Gets a value in aRegion with a the next new (never-before_used) key.
|
Operation |
getEntryWithPreviousKey(com.gemstone.gemfire.cache.Region aRegion)
Gets a value in aRegion with a random key that was previously used in the test.
|
Object |
getNewKey(com.gemstone.gemfire.cache.Region aRegion)
Gets a new (never before seen) key
|
Object |
getNewValue(Object key) |
Object |
getRandomKey(com.gemstone.gemfire.cache.Region aRegion)
Get a random key from the given region.
|
Object |
getRandomKey(com.gemstone.gemfire.cache.Region aRegion,
Object excludeKey)
Get a random key from the given region, excluding the key specified
by excludeKey.
|
com.gemstone.gemfire.cache.Region |
getRandomRegion(boolean allowRootRegion)
Return a currently existing random region.
|
com.gemstone.gemfire.cache.Region |
getRandomRegion(boolean allowRootRegion,
com.gemstone.gemfire.cache.Region excludeRegion,
int restriction)
Return a currently existing random region.
|
com.gemstone.gemfire.cache.Region |
getRandomRegionNoReplication(boolean allowRootRegion)
Return a currently existing random region that is not replicated, nor
are any of its subregions.
|
String |
getRegionConfigFromBB(String fullPathOfRegion)
Given a full path for a region, return its (String) regionConfig
The shared map has one key per VM in the form:
TxBB.RegConfigForPIDKey_xxxxx, where xxxxs is the PID for the current VM.
|
Map |
getRegionConfigMap()
Get a map containing the RegionDefintions for this VM.
|
static long |
getRoundRobinNumber()
Return the current roundRobin number.
|
Set |
getSubregions(com.gemstone.gemfire.cache.Region aRegion,
boolean recursive)
Return a Set of subregions of the given region, while handling
regionDestroyedExceptions.
|
Object |
getValueInVM(com.gemstone.gemfire.cache.Region aRegion,
Object key)
Call getValueInVM on the given region and key
|
Object |
getValueInVM(com.gemstone.gemfire.cache.Region aRegion,
Object key,
boolean translateToInvalidToken) |
Operation |
getWithExistingKey(com.gemstone.gemfire.cache.Region aRegion)
Gets a value in aRegion with a key existing in aRegion.
|
static void |
HydraTask_createPartitionedRegions()
Create the cache and Region (non-colocated PartitionedRegions)
|
static void |
HydraTask_createRegionForest()
Hydra task to create a forest of region hierarchies.
|
static void |
HydraTask_doOperations() |
static void |
HydraTask_populateRegions() |
static void |
HydraTask_startBridgeServer()
Stops the bridge server in this VM.
|
static void |
HydraTask_stopBridgeServer()
Stops the bridge server in this VM.
|
void |
initialize() |
static boolean |
inTxThreadWithTxInProgress() |
static boolean |
inTxVm() |
Operation |
invalEntry(boolean isLocalInval,
com.gemstone.gemfire.cache.Region aRegion,
Object key,
boolean entryNotFoundExcOK)
Invalidates an entry in aRegion.
|
Operation |
invalRegion(boolean isLocalInval,
com.gemstone.gemfire.cache.Region aRegion)
Invalidates the given region.
|
boolean |
isHierReplicated(com.gemstone.gemfire.cache.Region aRegion)
Return true if the region or any of its subregions is replicated,
return false otherwise.
|
static void |
logExecutionNumber()
Log the number of tasks that have been executed in this test.
|
static boolean |
logRoundRobinNumber()
Log the "round" number for this test.
|
void |
populateRegions() |
List<Operation> |
putAll(com.gemstone.gemfire.cache.Region r) |
Operation |
putEntry(com.gemstone.gemfire.cache.Region aRegion,
Object key,
BaseValueHolder value,
String opName)
Puts a new key/value in the given region.
|
void |
recordDestroyedRegion(com.gemstone.gemfire.cache.Region aRegion)
Save destroyed region(s) in the blackboard.
|
void |
recordRegionConfigInBB(String fullPathOfRegion,
String regionConfig)
Given a full path for a region, and its (String) regionConfig,
write it to the TxBB blackboard shared map.
|
Operation |
removeEntry(com.gemstone.gemfire.cache.Region aRegion,
boolean exists)
Removes an entry in aRegion.
|
static void |
StartTask_initialize()
Hydra start task to initialize dataPolicies to use in ViewTests
This allows specification of the txThread (client1) as Proxy or Cached
and the same for the validator (view) threads.
|
void |
summarizeRegionHier()
Log the regions and the number of keys in each.
|
boolean |
supportsConcurrentMapOps(com.gemstone.gemfire.cache.Region aRegion)
Determine whether or not concurrent map operations are supported for the given region.
|
Operation |
updateEntry(com.gemstone.gemfire.cache.Region aRegion,
Object key)
Updates an existing entry in aRegion.
|
public static TxUtil txUtilInstance
public RandomValues randomValues
protected int maxKeys
public int modValInitializer
protected boolean isSerialExecution
protected boolean isBridgeClient
protected HydraThreadLocal txState
public boolean suspendResume
public static final int NO_REPLICATION_RESTRICTION
public static final int NO_REPLICATION
protected static final String createCallbackPrefix
protected static final String updateCallbackPrefix
protected static final String invalidateCallbackPrefix
protected static final String destroyCallbackPrefix
protected static final String regionInvalidateCallbackPrefix
protected static final String regionDestroyCallbackPrefix
protected static final String memberIdString
public static void StartTask_initialize()
public void initialize()
public static void HydraTask_startBridgeServer()
public static void HydraTask_stopBridgeServer()
public static void HydraTask_createRegionForest()
public static void HydraTask_createPartitionedRegions()
public void createPartitionedRegions()
public static void HydraTask_populateRegions()
public void populateRegions()
public static void HydraTask_doOperations()
public static void logExecutionNumber()
public static boolean logRoundRobinNumber()
public static long getRoundRobinNumber()
public void createRegionHierarchy()
public void createEntries(com.gemstone.gemfire.cache.Region aRegion)
public com.gemstone.gemfire.cache.Region getRandomRegion(boolean allowRootRegion)
allowRootRegion - true if this call can return the root region, false otherwise.public com.gemstone.gemfire.cache.Region getRandomRegionNoReplication(boolean allowRootRegion)
allowRootRegion - true if this call can return the root region, false otherwise.public com.gemstone.gemfire.cache.Region getRandomRegion(boolean allowRootRegion,
com.gemstone.gemfire.cache.Region excludeRegion,
int restriction)
allowRootRegion - true if this call can return the root region, false otherwise.excludeRegion - Return a region other than this region, or null if none to exclude.restriction - Restriction on what region can be returned, for example
NO_REPLICATION_RESTRICTION, NO_REPLICATIONpublic void dispAllKeys()
public void summarizeRegionHier()
public static OpList doOperations()
public static OpList doOperations(boolean allowGetOperations)
allowGetOperations - - to prevent proxy clients from attempting
gets (since they have no storage this always
invokes the loader and oldValue is always
reported as null).public OpList doOperations(Vector operations, int numOperationsToDo)
operations - - a Vector of operations to choose from.numOperationsToDo - - the number of operations to execute.public OpList doOperations(Vector operations, int numOperationsToDo, boolean allowGetOperations)
operations - - a Vector of operations to choose from.numOperationsToDo - - the number of operations to execute.allowGetOperations - - if false, replace entry-get ops with entry-createpublic OpList doRepeatableReadOperations(int numOperationsToDo)
numOperationsToDo - The number of repeatable read operations to do.public OpList doNonrepeatableReadOperations(int numOperationsToDo)
numOperationsToDo - The number of repeatable read operations to do.public Operation createEntry(com.gemstone.gemfire.cache.Region aRegion, boolean exists)
aRegion - The region to create the new key in.exists - True if the key to create already exists, false
if the key has never before been created.public Operation updateEntry(com.gemstone.gemfire.cache.Region aRegion, Object key)
aRegion - The region to modify a key in.key - The key to modify.public Operation destroyEntry(boolean isLocalDestroy, com.gemstone.gemfire.cache.Region aRegion, Object key, boolean entryNotFoundExcOK)
isLocalDestroy - True if the opertion is a local destroy, false otherwise.aRegion - The region to destroy the entry in.key - The key to destroy.entryNotFoundExcOK - True if it is ok to get an EntryNotFoundException on this
destroy.public Operation removeEntry(com.gemstone.gemfire.cache.Region aRegion, boolean exists)
aRegion - The region to remove the entry from.exists - True if the key exists in the region, false otherwise.public Operation invalEntry(boolean isLocalInval, com.gemstone.gemfire.cache.Region aRegion, Object key, boolean entryNotFoundExcOK)
isLocalInval - True if the opertion is a local invalidate, false otherwise.aRegion - The region to invalidate the entry in.key - The key to invalidate.entryNotFoundExcOK - True if it is ok to get an EntryNotFoundException on this
invalidate.public Operation getWithExistingKey(com.gemstone.gemfire.cache.Region aRegion)
aRegion - The region to get from.public Operation getAll(com.gemstone.gemfire.cache.Region r)
public Operation getEntryWithExistingKey(com.gemstone.gemfire.cache.Region aRegion)
aRegion - The region to get from.public Operation containsKeyExisting(com.gemstone.gemfire.cache.Region aRegion)
aRegion - The region to get from.public Operation containsValueForKeyExisting(com.gemstone.gemfire.cache.Region aRegion)
aRegion - The region to get from.public Operation containsValueExisting(com.gemstone.gemfire.cache.Region aRegion)
aRegion - The region to get from.public Operation getEntryWithPreviousKey(com.gemstone.gemfire.cache.Region aRegion)
aRegion - The region to get from.public Object getNewKey(com.gemstone.gemfire.cache.Region aRegion)
public Operation getEntryWithNewKey(com.gemstone.gemfire.cache.Region aRegion)
aRegion - The region to get from.public Operation putEntry(com.gemstone.gemfire.cache.Region aRegion, Object key, BaseValueHolder value, String opName)
aRegion - The region to create the new key in.key - The key to use for the put.value - The value to put.opName - The operation to use for the returned Operation instance.public Operation getEntry(com.gemstone.gemfire.cache.Region aRegion, Object key, String opName)
aRegion - The region to create the new key in.key - The key to use for the put.opName - The operation to use for the returned Operation instance.public Operation invalRegion(boolean isLocalInval, com.gemstone.gemfire.cache.Region aRegion)
isLocalInval - True if the opertion is a local invalidate, false otherwise.aRegion - The region to invalidate.public Operation destroyRegion(boolean isLocalDestroy, com.gemstone.gemfire.cache.Region aRegion)
isLocalDestroy - True if the opertion is a local destroy, false otherwise.aRegion - The region to destroy.public Operation createRegion()
public Operation closeCache()
public Object getRandomKey(com.gemstone.gemfire.cache.Region aRegion)
aRegion - - The region to get the key from.public Object getRandomKey(com.gemstone.gemfire.cache.Region aRegion, Object excludeKey)
aRegion - - The region to get the key from.excludeKey - - The region to get the key from.public Object[] createRegionWithPath(String regionName, boolean fill)
regionName - - The full path name of a region.fill - - If true, then fill each created region with entries
according to TxPrms.maxEntriespublic void clearDestroyedRegions()
aRegion - The region being destroyed. Save it and all its children.public void recordDestroyedRegion(com.gemstone.gemfire.cache.Region aRegion)
aRegion - The region being destroyed. Save it and all its children.public void createDestroyedRegionsFromBB(boolean fill)
fill - True if each newly created region should be populated with
entries according to TxPrms.maxKeyspublic void createAllDestroyedRegions(boolean fill)
fill - True if each newly created region should be populated with
entries according to TxPrms.maxKeyspublic static boolean inTxThreadWithTxInProgress()
public static boolean inTxVm()
public boolean isHierReplicated(com.gemstone.gemfire.cache.Region aRegion)
aRegion - The region parent to test for replication.public Set getSubregions(com.gemstone.gemfire.cache.Region aRegion, boolean recursive)
aRegion - - The region to get subregions of.recursive - - If true, return all subregions, otherwise
only aRegion's subregions.public Map getRegionConfigMap()
public void recordRegionConfigInBB(String fullPathOfRegion, String regionConfig)
fullPathOfRegion - - the full path of the region to get the key for.regionConfig - - The (String) regionConfig for this regionpublic String getRegionConfigFromBB(String fullPathOfRegion)
fullPathOfRegion - - the full path of the region to get the key for.public boolean containsKey(com.gemstone.gemfire.cache.Region aRegion,
Object key)
aRegion - - The region to test for the key.key - - The key to use for containsKey.public Object getValueInVM(com.gemstone.gemfire.cache.Region aRegion, Object key)
aRegion - - The region to use for the call.key - - The key to use for the call.public Object getValueInVM(com.gemstone.gemfire.cache.Region aRegion, Object key, boolean translateToInvalidToken)
public boolean supportsConcurrentMapOps(com.gemstone.gemfire.cache.Region aRegion)
aRegion - - The region to checkCopyright © 2010-2015 Pivotal Software, Inc. All rights reserved.