Github user kohlmu-pivotal commented on a diff in the pull request:

    https://github.com/apache/geode/pull/716#discussion_r134006932
  
    --- Diff: 
geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ExecutionContext.java
 ---
    @@ -0,0 +1,54 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
    + * agreements. See the NOTICE file distributed with this work for 
additional information regarding
    + * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance with the 
License. You may obtain a
    + * copy of the License at
    + *
    + * http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software 
distributed under the License
    + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 
ANY KIND, either express
    + * or implied. See the License for the specific language governing 
permissions and limitations under
    + * the License.
    + */
    +
    +package org.apache.geode.internal.cache.tier.sockets;
    +
    +import org.apache.geode.cache.Cache;
    +import org.apache.geode.distributed.internal.InternalLocator;
    +
    +public class ExecutionContext {
    +  private Cache cache;
    +  private InternalLocator locator;
    +
    +  public ExecutionContext(Cache cache) {
    +    this.cache = cache;
    +  }
    +
    +  public ExecutionContext(InternalLocator locator) {
    +    this.locator = locator;
    +  }
    +
    +  // This throws if the cache isn't present because we know that non of 
the callers can take any
    +  // reasonable action if the cache is not present
    +  public Cache getCache() throws InvalidExecutionContextException {
    +    if (cache != null) {
    +      return cache;
    +    } else {
    +      throw new InvalidExecutionContextException(
    +          "Execution context's cache was accessed but isn't present. Did 
this happen on a locator? Operations on the locator should not try to operate 
on a cache");
    +    }
    +  }
    +
    +  // This throws if the locator isn't present because we know that non of 
the callers can take any
    +  // reasonable action if the locator is not present
    +  public InternalLocator getLocator() throws 
InvalidExecutionContextException {
    --- End diff --
    
    I think we should return a `Locator` rather than an `InternalLocator`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to