Gemfire JavaDocs
Class BootstrappingFunction
- java.lang.Object
-
- org.apache.geode.modules.util.BootstrappingFunction
-
- All Implemented Interfaces:
java.io.Serializable
,Function
,DataSerializable
,org.apache.geode.distributed.internal.MembershipListener
,Identifiable
public class BootstrappingFunction extends java.lang.Object implements Function, org.apache.geode.distributed.internal.MembershipListener, DataSerializable
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.geode.DataSerializable
DataSerializable.Replaceable
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ID
-
Constructor Summary
Constructors Constructor Description BootstrappingFunction()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
void
execute(FunctionContext context)
The method which contains the logic to be executed.void
fromData(java.io.DataInput in)
Reads the state of this object as primitive data from the givenDataInput
.java.lang.String
getId()
Return a unique function identifier, used to register the function withFunctionService
java.util.Collection<ResourcePermission>
getRequiredPermissions(java.lang.String regionName)
Returns the list of ResourcePermission this function requires.int
hashCode()
boolean
hasResult()
Specifies whether the function sends results while executing.boolean
isHA()
Specifies whether the function is eligible for re-execution (in case of failure).protected boolean
isLocator(Cache cache)
void
memberDeparted(org.apache.geode.distributed.internal.DistributionManager distributionManager, org.apache.geode.distributed.internal.membership.InternalDistributedMember id, boolean crashed)
void
memberJoined(org.apache.geode.distributed.internal.DistributionManager distributionManager, org.apache.geode.distributed.internal.membership.InternalDistributedMember id)
void
memberSuspect(org.apache.geode.distributed.internal.DistributionManager distributionManager, org.apache.geode.distributed.internal.membership.InternalDistributedMember id, org.apache.geode.distributed.internal.membership.InternalDistributedMember whoSuspected, java.lang.String reason)
boolean
optimizeForWrite()
Return true to indicate to GemFire the method requires optimization for writing the targetedFunctionService.onRegion(org.apache.geode.cache.Region)
and any associated routing objects.void
quorumLost(org.apache.geode.distributed.internal.DistributionManager distributionManager, java.util.Set<org.apache.geode.distributed.internal.membership.InternalDistributedMember> internalDistributedMembers, java.util.List<org.apache.geode.distributed.internal.membership.InternalDistributedMember> internalDistributedMembers2)
protected void
registerFunctions()
void
toData(java.io.DataOutput out)
Writes the state of this object as primitive data to the givenDataOutput
.protected Cache
verifyCacheExists()
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.geode.cache.execute.Function
getRequiredPermissions
-
-
-
-
Field Detail
-
ID
public static final java.lang.String ID
- See Also:
- Constant Field Values
-
-
Method Detail
-
execute
public void execute(FunctionContext context)
Description copied from interface:Function
The method which contains the logic to be executed. This method should be thread safe and may be invoked more than once on a given member for a singleExecution
. The context provided to this function is the one which was built using Execution. The contexts can be data dependent or data-independent so user should check to see if the context provided in parameter is instance ofRegionFunctionContext
.
-
isLocator
protected boolean isLocator(Cache cache)
-
verifyCacheExists
protected Cache verifyCacheExists()
-
getRequiredPermissions
public java.util.Collection<ResourcePermission> getRequiredPermissions(java.lang.String regionName)
Description copied from interface:Function
Returns the list of ResourcePermission this function requires.By default, functions require DATA:WRITE permission. If your function requires other permissions, you will need to override this method.
Please be as specific as possible when you set the required permissions for your function e.g. if your function reads from a region, it would be good to include the region name in your permission. It's better to return "DATA:READ:regionName" as the required permission other than "DATA:READ", because the latter means only users with read permission on ALL regions can execute your function.
All the permissions returned from this method will be ANDed together.
- Specified by:
getRequiredPermissions
in interfaceFunction
- Parameters:
regionName
- the region this function will be executed on. The regionName is optional and will only be present when the function is executed by an onRegion() executor. In other cases, it will be null. This method returns permissions appropriate to the context, independent of the presence of the regionName parameter.- Returns:
- a collection of
ResourcePermission
s indicating the permissions required to execute the function.
-
registerFunctions
protected void registerFunctions()
-
getId
public java.lang.String getId()
Description copied from interface:Function
Return a unique function identifier, used to register the function withFunctionService
- Specified by:
getId
in interfaceFunction
- Specified by:
getId
in interfaceIdentifiable
- Returns:
- string identifying this function
-
hasResult
public boolean hasResult()
Description copied from interface:Function
Specifies whether the function sends results while executing. The method returns false if no result is expected.
If this method returns false,
ResultCollector.getResult()
throwsFunctionException
.If this method returns true,
ResultCollector.getResult()
blocks and waits for the result of function execution
-
isHA
public boolean isHA()
Description copied from interface:Function
Specifies whether the function is eligible for re-execution (in case of failure).- Specified by:
isHA
in interfaceFunction
- Returns:
- whether the function is eligible for re-execution.
- See Also:
FunctionContext.isPossibleDuplicate()
-
optimizeForWrite
public boolean optimizeForWrite()
Description copied from interface:Function
Return true to indicate to GemFire the method requires optimization for writing the targeted
FunctionService.onRegion(org.apache.geode.cache.Region)
and any associated routing objects.Returning false will optimize for read behavior on the targeted
FunctionService.onRegion(org.apache.geode.cache.Region)
and any associated routing objects.This method is only consulted when Region passed to FunctionService#onRegion(org.apache.geode.cache.Region) is a partitioned region
- Specified by:
optimizeForWrite
in interfaceFunction
- Returns:
- false if the function is read only, otherwise returns true
- See Also:
FunctionService
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
memberDeparted
public void memberDeparted(org.apache.geode.distributed.internal.DistributionManager distributionManager, org.apache.geode.distributed.internal.membership.InternalDistributedMember id, boolean crashed)
- Specified by:
memberDeparted
in interfaceorg.apache.geode.distributed.internal.MembershipListener
-
memberJoined
public void memberJoined(org.apache.geode.distributed.internal.DistributionManager distributionManager, org.apache.geode.distributed.internal.membership.InternalDistributedMember id)
- Specified by:
memberJoined
in interfaceorg.apache.geode.distributed.internal.MembershipListener
-
memberSuspect
public void memberSuspect(org.apache.geode.distributed.internal.DistributionManager distributionManager, org.apache.geode.distributed.internal.membership.InternalDistributedMember id, org.apache.geode.distributed.internal.membership.InternalDistributedMember whoSuspected, java.lang.String reason)
- Specified by:
memberSuspect
in interfaceorg.apache.geode.distributed.internal.MembershipListener
-
quorumLost
public void quorumLost(org.apache.geode.distributed.internal.DistributionManager distributionManager, java.util.Set<org.apache.geode.distributed.internal.membership.InternalDistributedMember> internalDistributedMembers, java.util.List<org.apache.geode.distributed.internal.membership.InternalDistributedMember> internalDistributedMembers2)
- Specified by:
quorumLost
in interfaceorg.apache.geode.distributed.internal.MembershipListener
-
toData
public void toData(java.io.DataOutput out) throws java.io.IOException
Description copied from interface:DataSerializable
Writes the state of this object as primitive data to the givenDataOutput
.Since 5.7 it is possible for any method call to the specified
DataOutput
to throwGemFireRethrowable
. It should not be caught by user code. If it is it must be rethrown.- Specified by:
toData
in interfaceDataSerializable
- Parameters:
out
- theDataOutput
to write to- Throws:
java.io.IOException
- A problem occurs while writing toout
-
fromData
public void fromData(java.io.DataInput in) throws java.io.IOException, java.lang.ClassNotFoundException
Description copied from interface:DataSerializable
Reads the state of this object as primitive data from the givenDataInput
.- Specified by:
fromData
in interfaceDataSerializable
- Parameters:
in
- theDataInput
to read from- Throws:
java.io.IOException
- A problem occurs while reading fromin
java.lang.ClassNotFoundException
- A class could not be loaded while reading fromin
-
-