Class BootstrappingFunction
- All Implemented Interfaces:
Serializable,Function,DataSerializable,org.apache.geode.distributed.internal.MembershipListener,Identifiable
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.geode.DataSerializable
DataSerializable.Replaceable -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanvoidexecute(FunctionContext context) The method which contains the logic to be executed.voidReads the state of this object as primitive data from the givenDataInput.getId()Return a unique function identifier, used to register the function withFunctionServicegetRequiredPermissions(String regionName) Returns the list of ResourcePermission this function requires.inthashCode()booleanSpecifies whether the function sends results while executing.booleanisHA()Specifies whether the function is eligible for re-execution (in case of failure).protected booleanvoidmemberDeparted(org.apache.geode.distributed.internal.DistributionManager distributionManager, org.apache.geode.distributed.internal.membership.InternalDistributedMember id, boolean crashed) voidmemberJoined(org.apache.geode.distributed.internal.DistributionManager distributionManager, org.apache.geode.distributed.internal.membership.InternalDistributedMember id) voidmemberSuspect(org.apache.geode.distributed.internal.DistributionManager distributionManager, org.apache.geode.distributed.internal.membership.InternalDistributedMember id, org.apache.geode.distributed.internal.membership.InternalDistributedMember whoSuspected, String reason) booleanReturn true to indicate to GemFire the method requires optimization for writing the targetedFunctionService.onRegion(org.apache.geode.cache.Region)and any associated routing objects.voidquorumLost(org.apache.geode.distributed.internal.DistributionManager distributionManager, Set<org.apache.geode.distributed.internal.membership.InternalDistributedMember> internalDistributedMembers, List<org.apache.geode.distributed.internal.membership.InternalDistributedMember> internalDistributedMembers2) protected voidvoidtoData(DataOutput out) Writes the state of this object as primitive data to the givenDataOutput.protected CacheMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.geode.cache.execute.Function
getRequiredPermissions
-
Field Details
-
ID
- See Also:
-
-
Constructor Details
-
BootstrappingFunction
public BootstrappingFunction()
-
-
Method Details
-
execute
Description copied from interface:FunctionThe 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
-
verifyCacheExists
-
getRequiredPermissions
Description copied from interface:FunctionReturns 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:
getRequiredPermissionsin 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
ResourcePermissions indicating the permissions required to execute the function.
-
registerFunctions
protected void registerFunctions() -
getId
Description copied from interface:FunctionReturn a unique function identifier, used to register the function withFunctionService- Specified by:
getIdin interfaceFunction- Specified by:
getIdin interfaceIdentifiable- Returns:
- string identifying this function
-
hasResult
public boolean hasResult()Description copied from interface:FunctionSpecifies 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:FunctionSpecifies whether the function is eligible for re-execution (in case of failure). -
optimizeForWrite
public boolean optimizeForWrite()Description copied from interface:FunctionReturn 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:
optimizeForWritein interfaceFunction- Returns:
- false if the function is read only, otherwise returns true
- See Also:
-
hashCode
public int hashCode() -
equals
-
memberDeparted
public void memberDeparted(org.apache.geode.distributed.internal.DistributionManager distributionManager, org.apache.geode.distributed.internal.membership.InternalDistributedMember id, boolean crashed) - Specified by:
memberDepartedin 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:
memberJoinedin 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, String reason) - Specified by:
memberSuspectin interfaceorg.apache.geode.distributed.internal.MembershipListener
-
quorumLost
public void quorumLost(org.apache.geode.distributed.internal.DistributionManager distributionManager, Set<org.apache.geode.distributed.internal.membership.InternalDistributedMember> internalDistributedMembers, List<org.apache.geode.distributed.internal.membership.InternalDistributedMember> internalDistributedMembers2) - Specified by:
quorumLostin interfaceorg.apache.geode.distributed.internal.MembershipListener
-
toData
Description copied from interface:DataSerializableWrites the state of this object as primitive data to the givenDataOutput.Since 5.7 it is possible for any method call to the specified
DataOutputto throwGemFireRethrowable. It should not be caught by user code. If it is it must be rethrown.- Specified by:
toDatain interfaceDataSerializable- Parameters:
out- theDataOutputto write to- Throws:
IOException- A problem occurs while writing toout
-
fromData
Description copied from interface:DataSerializableReads the state of this object as primitive data from the givenDataInput.- Specified by:
fromDatain interfaceDataSerializable- Parameters:
in- theDataInputto read from- Throws:
IOException- A problem occurs while reading frominClassNotFoundException- A class could not be loaded while reading fromin
-