fix conflicts backport from tomee 7.0.x

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

Branch: refs/heads/tomee-1.7.x
Commit: 711ddf32ade0e858c54f1f4f3992a626274a8fcb
Parents: 76da734
Author: Thiago Veronezi <[email protected]>
Authored: Fri Jan 5 14:33:44 2018 -0500
Committer: Thiago Veronezi <[email protected]>
Committed: Wed Jan 17 22:12:35 2018 -0500

----------------------------------------------------------------------
 .../core/instance/InstanceCreatorRunnable.java  | 41 ++++++++++++++++++++
 1 file changed, 41 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/711ddf32/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
new file mode 100644
index 0000000..d87c330
--- /dev/null
+++ 
b/container/openejb-core/src/main/java/org/apache/openejb/core/instance/InstanceCreatorRunnable.java
@@ -0,0 +1,41 @@
+/*
+ * 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.openejb.core.instance;
+
+import org.apache.openejb.core.mdb.Instance;
+
+public final class InstanceCreatorRunnable implements Runnable {
+
+    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.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) {
+            data.getPool().add(obj, offset);
+        }
+    }
+}
\ No newline at end of file

Reply via email to