public class BootstrappingFunction extends Object implements Function, org.apache.geode.distributed.internal.MembershipListener, DataSerializable
DataSerializable.Replaceable
Constructor and Description |
---|
BootstrappingFunction() |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
void |
execute(FunctionContext context)
The method which contains the logic to be executed.
|
void |
fromData(DataInput in)
Reads the state of this object as primitive data from the given
DataInput . |
String |
getId()
Return a unique function identifier, used to register the function with
FunctionService |
Collection<ResourcePermission> |
getRequiredPermissions(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,
String reason) |
boolean |
optimizeForWrite()
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. |
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) |
protected void |
registerFunctions() |
void |
toData(DataOutput out)
Writes the state of this object as primitive data to the given
DataOutput . |
protected Cache |
verifyCacheExists() |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
getRequiredPermissions
exists, find, remove
public static final String ID
public void execute(FunctionContext context)
Function
Execution
. 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 of RegionFunctionContext
.protected boolean isLocator(Cache cache)
protected Cache verifyCacheExists()
public Collection<ResourcePermission> getRequiredPermissions(String regionName)
Function
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.
getRequiredPermissions
in interface Function
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.ResourcePermission
s indicating the permissions required to
execute the function.protected void registerFunctions()
public String getId()
Function
FunctionService
getId
in interface Function
getId
in interface Identifiable
public boolean hasResult()
Function
If this method returns false, ResultCollector.getResult()
throws
FunctionException
.
If this method returns true, ResultCollector.getResult()
blocks and
waits for the result of function execution
public boolean isHA()
Function
isHA
in interface Function
FunctionContext.isPossibleDuplicate()
public boolean optimizeForWrite()
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
optimizeForWrite
in interface Function
FunctionService
public void memberDeparted(org.apache.geode.distributed.internal.DistributionManager distributionManager, org.apache.geode.distributed.internal.membership.InternalDistributedMember id, boolean crashed)
memberDeparted
in interface org.apache.geode.distributed.internal.MembershipListener
public void memberJoined(org.apache.geode.distributed.internal.DistributionManager distributionManager, org.apache.geode.distributed.internal.membership.InternalDistributedMember id)
memberJoined
in interface org.apache.geode.distributed.internal.MembershipListener
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)
memberSuspect
in interface org.apache.geode.distributed.internal.MembershipListener
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)
quorumLost
in interface org.apache.geode.distributed.internal.MembershipListener
public void toData(DataOutput out) throws IOException
DataSerializable
DataOutput
.
Since 5.7 it is possible for any method call to the specified DataOutput
to throw
GemFireRethrowable
. It should not be caught by user code. If it is it
must be rethrown.
toData
in interface DataSerializable
out
- the DataOutput
to write toIOException
- A problem occurs while writing to out
public void fromData(DataInput in) throws IOException, ClassNotFoundException
DataSerializable
DataInput
.fromData
in interface DataSerializable
in
- the DataInput
to read fromIOException
- A problem occurs while reading from in
ClassNotFoundException
- A class could not be loaded while reading from in