1 /***
2 * Copyright 2003-2010 Terracotta, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package net.sf.ehcache.pool.impl;
18
19 import net.sf.ehcache.pool.PoolableStore;
20 import net.sf.ehcache.pool.SizeOfEngine;
21 import net.sf.ehcache.pool.PoolAccessor;
22 import net.sf.ehcache.pool.PoolEvictor;
23
24 /***
25 * A pool which loosely obeys to its bound: it can allow the accessors to consume more bytes than what
26 * has been configured if that helps concurrency.
27
28 * @author Ludovic Orban
29 * @author Chris Dennis
30 */
31 public class BoundedPool extends AbstractPool<PoolableStore> {
32
33 /***
34 * Create a BoundedPool instance
35 *
36 * @param maximumPoolSize the maximum size of the pool, in bytes.
37 * @param evictor the pool evictor, for cross-store eviction.
38 * @param defaultSizeOfEngine the default SizeOf engine used by the accessors.
39 */
40 public BoundedPool(long maximumPoolSize, PoolEvictor<PoolableStore> evictor, SizeOfEngine defaultSizeOfEngine) {
41 super(maximumPoolSize, evictor, defaultSizeOfEngine);
42 }
43
44 /***
45 * {@inheritDoc}
46 */
47 public PoolAccessor createPoolAccessor(PoolableStore store, SizeOfEngine sizeOfEngine) {
48 AtomicPoolAccessor accessor = new AtomicPoolAccessor(this, store, sizeOfEngine, 0);
49 registerPoolAccessor(accessor);
50 return accessor;
51 }
52 }