Class RegionSizeFunction

  • java.lang.Object
    • org.apache.geode.modules.util.RegionSizeFunction
    • Constructor Detail

      • RegionSizeFunction

        public RegionSizeFunction()
    • 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 single 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.
        Specified by:
        execute in interface Function
        Parameters:
        context - as created by Execution
      • 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 interface Function
        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.
      • getId

        public java.lang.String getId()
        Description copied from interface: Function
        Return a unique function identifier, used to register the function with FunctionService
        Specified by:
        getId in interface Function
        Specified by:
        getId in interface Identifiable
        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() throws FunctionException.

        If this method returns true, ResultCollector.getResult() blocks and waits for the result of function execution

        Specified by:
        hasResult in interface Function
        Returns:
        whether this function returns a Result back to the caller.
      • 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 interface Function
        Returns:
        whether the function is eligible for re-execution.
        See Also:
        FunctionContext.isPossibleDuplicate()
      • toData

        public void toData​(java.io.DataOutput out)
        Description copied from interface: DataSerializable
        Writes the state of this object as primitive data to the given 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.

        Specified by:
        toData in interface DataSerializable
        Parameters:
        out - the DataOutput to write to
      • fromData

        public void fromData​(java.io.DataInput in)
        Description copied from interface: DataSerializable
        Reads the state of this object as primitive data from the given DataInput.
        Specified by:
        fromData in interface DataSerializable
        Parameters:
        in - the DataInput to read from