5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25 package sun.java2d;
26
27 import java.lang.ref.Reference;
28 import java.util.concurrent.ConcurrentLinkedQueue;
29
30 /**
31 * This ReentrantContextProvider implementation uses one ConcurrentLinkedQueue
32 * to store all ReentrantContext instances (thread and its child contexts)
33 *
34 * Note: this implementation keeps less contexts in memory depending on the
35 * concurrent active threads in contrary to a ThreadLocal provider. However,
36 * it is slower in highly concurrent workloads.
37 *
38 * @param <K> ReentrantContext subclass
39 */
40 public abstract class ReentrantContextProviderCLQ<K extends ReentrantContext>
41 extends ReentrantContextProvider<K>
42 {
43 // ReentrantContext queue to store all contexts
44 private final ConcurrentLinkedQueue<Reference<K>> ctxQueue
45 = new ConcurrentLinkedQueue<Reference<K>>();
|
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package com.sun;
27
28 import java.lang.ref.Reference;
29 import java.util.concurrent.ConcurrentLinkedQueue;
30
31 /**
32 * This ReentrantContextProvider implementation uses one ConcurrentLinkedQueue
33 * to store all ReentrantContext instances (thread and its child contexts)
34 *
35 * Note: this implementation keeps less contexts in memory depending on the
36 * concurrent active threads in contrary to a ThreadLocal provider. However,
37 * it is slower in highly concurrent workloads.
38 *
39 * @param <K> ReentrantContext subclass
40 */
41 public abstract class ReentrantContextProviderCLQ<K extends ReentrantContext>
42 extends ReentrantContextProvider<K>
43 {
44 // ReentrantContext queue to store all contexts
45 private final ConcurrentLinkedQueue<Reference<K>> ctxQueue
46 = new ConcurrentLinkedQueue<Reference<K>>();
|