polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paulmer...@apache.org
Subject [1/6] zest-java git commit: Minor changes to UnitOfWorkInstance
Date Mon, 26 Sep 2016 16:14:49 GMT
Repository: zest-java
Updated Branches:
  refs/heads/develop c5cbb597e -> 90401ddf2


Minor changes to UnitOfWorkInstance

Basically, making fields final when possible, some formatting and
removing outdated comments.


Project: http://git-wip-us.apache.org/repos/asf/zest-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/zest-java/commit/91cc592b
Tree: http://git-wip-us.apache.org/repos/asf/zest-java/tree/91cc592b
Diff: http://git-wip-us.apache.org/repos/asf/zest-java/diff/91cc592b

Branch: refs/heads/develop
Commit: 91cc592bdbafbf91e9c9f7b979f153dd6a7434d4
Parents: c5cbb59
Author: Paul Merlin <paulmerlin@apache.org>
Authored: Mon Sep 19 21:26:10 2016 -0700
Committer: Paul Merlin <paulmerlin@apache.org>
Committed: Mon Sep 19 21:26:10 2016 -0700

----------------------------------------------------------------------
 .../runtime/unitofwork/UnitOfWorkInstance.java  | 35 ++++++++------------
 1 file changed, 14 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-java/blob/91cc592b/core/runtime/src/main/java/org/apache/zest/runtime/unitofwork/UnitOfWorkInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/unitofwork/UnitOfWorkInstance.java
b/core/runtime/src/main/java/org/apache/zest/runtime/unitofwork/UnitOfWorkInstance.java
index 8ca082e..bd125df 100755
--- a/core/runtime/src/main/java/org/apache/zest/runtime/unitofwork/UnitOfWorkInstance.java
+++ b/core/runtime/src/main/java/org/apache/zest/runtime/unitofwork/UnitOfWorkInstance.java
@@ -64,7 +64,7 @@ import static org.apache.zest.api.unitofwork.UnitOfWorkCallback.UnitOfWorkStatus
 
 public final class UnitOfWorkInstance
 {
-    private static final ThreadLocal<Stack<UnitOfWorkInstance>> current = new
ThreadLocal<Stack<UnitOfWorkInstance>>()
+    private static final ThreadLocal<Stack<UnitOfWorkInstance>> CURRENT = new
ThreadLocal<Stack<UnitOfWorkInstance>>()
     {
         @Override
         protected Stack<UnitOfWorkInstance> initialValue()
@@ -72,43 +72,37 @@ public final class UnitOfWorkInstance
             return new Stack<>();
         }
     };
-    private MetricsTimer.Context metricsTimer;
 
     public static Stack<UnitOfWorkInstance> getCurrent()
     {
-        return current.get();
+        return CURRENT.get();
     }
 
+    private final HashMap<EntityReference, EntityInstance> instanceCache = new HashMap<>();
+    private final HashMap<EntityStore, EntityStoreUnitOfWork> storeUnitOfWork = new
HashMap<>();
     private final ModuleSpi module;
-    private long currentTime;
-    private MetricsProvider metrics;
-    final HashMap<EntityReference, EntityInstance> instanceCache;
-    final HashMap<EntityStore, EntityStoreUnitOfWork> storeUnitOfWork;
+    private final Usecase usecase;
+    private final long currentTime;
+    private final MetricsProvider metrics;
 
     private boolean open;
-
     private boolean paused;
 
-    /**
-     * Lazy query builder factory.
-     */
-    private Usecase usecase;
-
+    private MetricsTimer.Context metricsTimer;
     private MetaInfo metaInfo;
-
     private List<UnitOfWorkCallback> callbacks;
 
     public UnitOfWorkInstance( ModuleSpi module, Usecase usecase, long currentTime, MetricsProvider
metrics )
     {
         this.module = module;
+        this.usecase = usecase;
         this.currentTime = currentTime;
+        this.metrics = metrics;
+
         this.open = true;
-        instanceCache = new HashMap<>();
-        storeUnitOfWork = new HashMap<>();
         getCurrent().push( this );
-        paused = false;
-        this.usecase = usecase;
-        startCapture( metrics );
+        this.paused = false;
+        startCapture();
     }
 
     public long currentTime()
@@ -507,9 +501,8 @@ public final class UnitOfWorkInstance
         metricsTimer.stop();
     }
 
-    private void startCapture( MetricsProvider metrics )
+    private void startCapture()
     {
-        this.metrics = metrics;
         incrementCount();
         startTimer( metrics );
     }


Mime
View raw message