Github user bschuchardt commented on a diff in the pull request:
https://github.com/apache/geode/pull/444#discussion_r110697384
--- Diff:
geode-core/src/main/java/org/apache/geode/internal/cache/DistributedCacheOperation.java
---
@@ -240,12 +240,37 @@ public boolean containsRegionContentChange() {
return true;
}
+ public long startOperation() {
+ DistributedRegion region = getRegion();
+ long viewVersion = -1;
+ if (this.containsRegionContentChange()) {
+ viewVersion = region.getDistributionAdvisor().startOperation();
+ }
+ if (logger.isTraceEnabled(LogMarker.STATE_FLUSH_OP)) {
+ logger.trace(LogMarker.STATE_FLUSH_OP, "dispatching operation in
view version {}",
+ viewVersion);
+ }
+ return viewVersion;
+ }
+
+ public void endOperation(long viewVersion) {
+ DistributedRegion region = getRegion();
+ if (viewVersion != -1) {
+ region.getDistributionAdvisor().endOperation(viewVersion);
+ if (logger.isDebugEnabled()) {
+ logger.trace(LogMarker.STATE_FLUSH_OP, "done dispatching operation
in view version {}",
+ viewVersion);
+ }
+ }
+ }
+
/**
* Distribute a cache operation to other members of the distributed
system. This method determines
* who the recipients are and handles careful delivery of the operation
to those members.
*/
public void distribute() {
--- End diff --
Decentralizing the start/end of the op seems fragile to me. Could you at
least change the javadocs to state that startOperation must be invoked before
distribute() and have the distribute() method throw an exception if
startOperation has not been invoked? Or maybe it would be even better to make
distribute() private and have startOperation invoke it.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---