|
12 | 12 | * or implied. See the License for the specific language governing permissions and limitations under
|
13 | 13 | * the License.
|
14 | 14 | */
|
15 |
| - |
16 | 15 | package org.apache.geode.internal.protocol;
|
17 | 16 |
|
18 |
| - |
19 | 17 | import org.apache.geode.annotations.Experimental;
|
20 | 18 | import org.apache.geode.cache.Cache;
|
21 | 19 | import org.apache.geode.distributed.Locator;
|
22 |
| -import org.apache.geode.distributed.internal.InternalLocator; |
23 | 20 | import org.apache.geode.internal.exception.InvalidExecutionContextException;
|
24 | 21 | import org.apache.geode.internal.protocol.state.ConnectionStateProcessor;
|
25 | 22 | import org.apache.geode.internal.protocol.statistics.ProtocolClientStatistics;
|
26 | 23 |
|
27 | 24 | @Experimental
|
28 |
| -public class MessageExecutionContext { |
29 |
| - private final Cache cache; |
30 |
| - private final Locator locator; |
31 |
| - private final ProtocolClientStatistics statistics; |
32 |
| - private ConnectionStateProcessor connectionStateProcessor; |
33 |
| - |
34 |
| - public MessageExecutionContext(Cache cache, ProtocolClientStatistics statistics, |
35 |
| - ConnectionStateProcessor initialConnectionStateProcessor) { |
36 |
| - this.cache = cache; |
37 |
| - this.locator = null; |
38 |
| - this.statistics = statistics; |
39 |
| - this.connectionStateProcessor = initialConnectionStateProcessor; |
40 |
| - } |
| 25 | +public abstract class MessageExecutionContext { |
| 26 | + protected final ProtocolClientStatistics statistics; |
| 27 | + protected ConnectionStateProcessor connectionStateProcessor; |
41 | 28 |
|
42 |
| - public MessageExecutionContext(InternalLocator locator, ProtocolClientStatistics statistics, |
43 |
| - ConnectionStateProcessor initialConnectionStateProcessor) { |
44 |
| - this.locator = locator; |
45 |
| - this.cache = null; |
| 29 | + public MessageExecutionContext(ProtocolClientStatistics statistics, |
| 30 | + ConnectionStateProcessor connectionStateProcessor) { |
46 | 31 | this.statistics = statistics;
|
47 |
| - connectionStateProcessor = initialConnectionStateProcessor; |
| 32 | + this.connectionStateProcessor = connectionStateProcessor; |
48 | 33 | }
|
49 | 34 |
|
50 | 35 | public ConnectionStateProcessor getConnectionStateProcessor() {
|
51 | 36 | return connectionStateProcessor;
|
52 | 37 | }
|
53 | 38 |
|
54 |
| - /** |
55 |
| - * Returns the cache associated with this execution |
56 |
| - * <p> |
57 |
| - * |
58 |
| - * @throws InvalidExecutionContextException if there is no cache available |
59 |
| - */ |
60 |
| - public Cache getCache() throws InvalidExecutionContextException { |
61 |
| - if (cache != null) { |
62 |
| - return cache; |
63 |
| - } |
64 |
| - throw new InvalidExecutionContextException( |
65 |
| - "Operations on the locator should not to try to operate on a cache"); |
66 |
| - } |
| 39 | + public abstract Cache getCache() throws InvalidExecutionContextException; |
67 | 40 |
|
68 |
| - /** |
69 |
| - * Returns the locator associated with this execution |
70 |
| - * <p> |
71 |
| - * |
72 |
| - * @throws InvalidExecutionContextException if there is no locator available |
73 |
| - */ |
74 |
| - public Locator getLocator() throws InvalidExecutionContextException { |
75 |
| - if (locator != null) { |
76 |
| - return locator; |
77 |
| - } |
78 |
| - throw new InvalidExecutionContextException( |
79 |
| - "Operations on the server should not to try to operate on a locator"); |
80 |
| - } |
| 41 | + public abstract Locator getLocator() throws InvalidExecutionContextException; |
81 | 42 |
|
82 | 43 | /**
|
83 | 44 | * Returns the statistics for recording operation stats. In a unit test environment this may not
|
|
0 commit comments