FunctionContext (Apache Geode 1.15.4)

org.apache.geode.cache.execute

## Interface FunctionContext<T1>

- All Known Subinterfaces:
    RegionFunctionContext

      public interface FunctionContext<T1>

  Defines the execution context of a `Function`. It is required by the `Function.execute(FunctionContext)` to execute a `Function` on a particular member.

  A context can be data dependent or data independent. For data dependent functions refer to `RegionFunctionContext`

  This interface is implemented by GemFire. Instances of it will be passed in to `Function.execute(FunctionContext)`.

  Since:
    GemFire 6.0
  See Also:
    `RegionFunctionContext`

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `T1` | `getArguments()` Returns the arguments provided to this function execution.
    `Cache` | `getCache()`
    `String` | `getFunctionId()` Returns the identifier of the function.
    `default String` | `getMemberName()` a convenience method to get the name of the member this function executes on.
    `Object` | `getPrincipal()` If available, returns the principal that has been authenticated to execute this function.
    `<T2> ResultSender<T2>` | `getResultSender()` Returns the ResultSender which is used to add the ability for an execute method to send a single result back, or break its result into multiple pieces and send each piece back to the calling thread's ResultCollector.
    `boolean` | `isPossibleDuplicate()` Returns a boolean to identify whether this is a re-execute.

- - ### Method Detail

    - #### getArguments

          T1 getArguments()

      Returns the arguments provided to this function execution. These are the arguments specified by the caller using `Execution.setArguments(Object)`
      Returns:
        the arguments or null if there are no arguments
      Since:
        GemFire 6.0

    - #### getFunctionId

          String getFunctionId()

      Returns the identifier of the function.
      Returns:
        a unique identifier
      Since:
        GemFire 6.0
      See Also:
        `Function.getId()`

    - #### getResultSender

          <T2> ResultSender<T2> getResultSender()

      Returns the ResultSender which is used to add the ability for an execute method to send a single result back, or break its result into multiple pieces and send each piece back to the calling thread's ResultCollector. The returned ResultSender is only valid for the duration of the function call. If the Function needs to return a result, the result should be sent before the function exits.
      Type Parameters:
        `T2` - the type handled by the returned `ResultSender`
      Returns:
        the `ResultSender` associated with this `FunctionContext`
      Since:
        GemFire 6.0

    - #### isPossibleDuplicate

          boolean isPossibleDuplicate()

      Returns a boolean to identify whether this is a re-execute. Returns true if it is a re-execute else returns false
      Returns:
        a boolean (true) to identify whether it is a re-execute (else false)
      Since:
        GemFire 6.5
      See Also:
        `Function.isHA()`

    - #### getCache

          Cache getCache()

    - #### getMemberName

          default String getMemberName()

      a convenience method to get the name of the member this function executes on. call this function once in your function execution to avoid performance issues.
      Returns:
        member name or id if name is blank

    - #### getPrincipal

          Object getPrincipal()

      If available, returns the principal that has been authenticated to execute this function. This will always be null if the `LegacySecurityService` is in use.
      Returns:
        the principal that has been authenticated