From b2641afe7e5ee55a74d471415b31e31853e9afce Mon Sep 17 00:00:00 2001 From: Brett Wooldridge Date: Wed, 12 Feb 2014 23:11:57 +0900 Subject: [PATCH] Add license header and class-level javadoc. --- .../hikari/SpecializedConcurrentBag.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/main/java/com/zaxxer/hikari/SpecializedConcurrentBag.java b/src/main/java/com/zaxxer/hikari/SpecializedConcurrentBag.java index 01890047..844b31dc 100644 --- a/src/main/java/com/zaxxer/hikari/SpecializedConcurrentBag.java +++ b/src/main/java/com/zaxxer/hikari/SpecializedConcurrentBag.java @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2013 Brett Wooldridge + * + * Licensed 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 com.zaxxer.hikari; import java.util.ArrayList; @@ -8,6 +23,19 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicStampedReference; import java.util.concurrent.locks.AbstractQueuedLongSynchronizer; +/** + * This is a specialized concurrent bag that achieves superior performance + * to LinkedBlockingQueue and LinkedTransferQueue for the purposes of a + * connection pool. It uses ThreadLocal storage when possible to avoid + * locks, but resorts to scanning a common collection if there are no + * available connections in the ThreadLocal list. It is a "lock-less" + * implementation using a specialized AbstractQueuedLongSynchronizer to + * manage cross-thread signaling. + * + * @author Brett Wooldridge + * + * @param the templated type to store in the bag + */ public class SpecializedConcurrentBag { static final int NOT_IN_USE = 0;