addressing pr review 
https://github.com/apache/tomee/pull/117#discussion_r159500803 tx SvetlinZarev


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/d1f3d5cd
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/d1f3d5cd
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/d1f3d5cd

Branch: refs/heads/master
Commit: d1f3d5cd3459ef3dcfff10406d7f6bca05f718d9
Parents: 99f35db
Author: Thiago Veronezi <thi...@veronezi.org>
Authored: Fri Jan 5 14:33:44 2018 -0500
Committer: Thiago Veronezi <thi...@veronezi.org>
Committed: Fri Jan 5 14:33:44 2018 -0500

----------------------------------------------------------------------
 .../openejb/core/instance/InstanceCreatorRunnable.java  | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/d1f3d5cd/container/openejb-core/src/main/java/org/apache/openejb/core/instance/InstanceCreatorRunnable.java
----------------------------------------------------------------------
diff --git 
a/container/openejb-core/src/main/java/org/apache/openejb/core/instance/InstanceCreatorRunnable.java
 
b/container/openejb-core/src/main/java/org/apache/openejb/core/instance/InstanceCreatorRunnable.java
index fc15451..d87c330 100644
--- 
a/container/openejb-core/src/main/java/org/apache/openejb/core/instance/InstanceCreatorRunnable.java
+++ 
b/container/openejb-core/src/main/java/org/apache/openejb/core/instance/InstanceCreatorRunnable.java
@@ -19,28 +19,22 @@ package org.apache.openejb.core.instance;
 import org.apache.openejb.core.mdb.Instance;
 
 public final class InstanceCreatorRunnable implements Runnable {
-    private final long maxAge;
-    private final long iteration;
-    private final double maxAgeOffset;
-    private final long min;
+
     private final InstanceManagerData data;
     private final InstanceManager.InstanceSupplier supplier;
+    private final long offset;
 
     public InstanceCreatorRunnable(final long maxAge, final long iteration, 
final long min, final double maxAgeOffset,
                                    final InstanceManagerData data, final 
InstanceManager.InstanceSupplier supplier) {
-        this.maxAge = maxAge;
-        this.iteration = iteration;
-        this.min = min;
-        this.maxAgeOffset = maxAgeOffset;
         this.data = data;
         this.supplier = supplier;
+        this.offset = maxAge > 0 ? (long) (maxAge / maxAgeOffset * min * 
iteration) % maxAge : 0l;
     }
 
     @Override
     public void run() {
         final Instance obj = supplier.create();
         if (obj != null) {
-            final long offset = maxAge > 0 ? (long) (maxAge / maxAgeOffset * 
min * iteration) % maxAge : 0l;
             data.getPool().add(obj, offset);
         }
     }

Reply via email to