geode-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (GEODE-393) FunctionContext should provide a Cache
Date Fri, 23 Jun 2017 21:11:01 GMT

    [ https://issues.apache.org/jira/browse/GEODE-393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16061502#comment-16061502
] 

ASF GitHub Bot commented on GEODE-393:
--------------------------------------

Github user jinmeiliao commented on a diff in the pull request:

    https://github.com/apache/geode/pull/589#discussion_r123845237
  
    --- Diff: geode-core/src/main/java/org/apache/geode/internal/cache/execute/FunctionContextImpl.java
---
    @@ -37,20 +38,25 @@
     
       private String functionId = null;
     
    +  private Cache cache = null;
    +
       private ResultSender resultSender = null;
     
       private final boolean isPossDup;
     
       public FunctionContextImpl(final String functionId, final Object args,
           ResultSender resultSender) {
    -    this.functionId = functionId;
    -    this.args = args;
    -    this.resultSender = resultSender;
    -    this.isPossDup = false;
    +    this(null, functionId, args, resultSender, false);
    +  }
    +
    +  public FunctionContextImpl(final Cache cache, final String functionId, final Object
args,
    +      ResultSender resultSender) {
    +    this(cache, functionId, args, resultSender, false);
       }
     
    -  public FunctionContextImpl(final String functionId, final Object args, ResultSender
resultSender,
    -      boolean isPossibleDuplicate) {
    +  public FunctionContextImpl(final Cache cache, final String functionId, final Object
args,
    +      ResultSender resultSender, boolean isPossibleDuplicate) {
    --- End diff --
    
    I agree, once we get rid of that static gemfire cache function, these changes will be
necessary. better start making the changes somewhere. 


> FunctionContext should provide a Cache
> --------------------------------------
>
>                 Key: GEODE-393
>                 URL: https://issues.apache.org/jira/browse/GEODE-393
>             Project: Geode
>          Issue Type: Improvement
>          Components: functions
>            Reporter: Dan Smith
>            Assignee: David Anuta
>              Labels: starter
>
> FunctionContext has methods to get the arguments to the function and the result sender,
but there is no way to get the Cache or DistributedSystem.
> This means pretty much any function will need to statically look up the cache using CacheFactory.getAnyInstance().
While that works, it makes it impossible to write unit tests for functions by passing in a
mock cache.
> Note that onRegion functions are provided a RegionFunctionContext, which does provide
these functions with a means to look up the cache, but not all functions are applied to a
region.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message