fix merge

Signed-off-by: gregw <gregw@webtide.com>
This commit is contained in:
gregw 2020-09-16 23:34:38 +02:00
parent b7a4c36286
commit f3f918ade2
3 changed files with 13 additions and 54 deletions

View File

@ -1,18 +1,18 @@
//
// ========================================================================
// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
// This program and the accompanying materials are made available under
// the terms of the Eclipse Public License 2.0 which is available at
// https://www.eclipse.org/legal/epl-2.0
//
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
// This Source Code may also be made available under the following
// Secondary Licenses when the conditions for such availability set
// forth in the Eclipse Public License, v. 2.0 are satisfied:
// the Apache License v2.0 which is available at
// https://www.apache.org/licenses/LICENSE-2.0
//
// You may elect to redistribute this code under either of these licenses.
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
// ========================================================================
//

View File

@ -214,31 +214,6 @@ public class Pool<T> implements AutoCloseable, Dumpable
}
}
/**
* Acquire the entry from the pool at the specified index. This method bypasses the thread-local mechanism.
* @deprecated No longer supported. Instead use a {@link StrategyType} to configure the pool.
* @param idx the index of the entry to acquire.
* @return the specified entry or null if there is none at the specified index or if it is not available.
*/
@Deprecated
public Entry acquireAt(int idx)
{
if (closed)
return null;
try
{
Entry entry = entries.get(idx);
if (entry.tryAcquire())
return entry;
}
catch (IndexOutOfBoundsException e)
{
// no entry at that index
}
return null;
}
/**
* Acquire an entry from the pool.
* Only enabled entries will be returned from this method and their enable method must not be called.
@ -272,7 +247,7 @@ public class Pool<T> implements AutoCloseable, Dumpable
}
catch (IndexOutOfBoundsException e)
{
LOGGER.ignore(e);
LOGGER.trace("IGNORED", e);
size = entries.size();
}
index = (index + 1) % size;

View File

@ -307,22 +307,6 @@ public class PoolTest
assertThat(pool.values().isEmpty(), is(false));
}
@ParameterizedTest
@MethodSource(value = "strategy")
public void testAcquireAt(Factory factory)
{
Pool<String> pool = factory.getPool(2);
pool.reserve(-1).enable("aaa", false);
pool.reserve(-1).enable("bbb", false);
assertThat(pool.acquireAt(2), nullValue());
assertThat(pool.acquireAt(0), notNullValue());
assertThat(pool.acquireAt(0), nullValue());
assertThat(pool.acquireAt(1), notNullValue());
assertThat(pool.acquireAt(1), nullValue());
}
@ParameterizedTest
@MethodSource(value = "strategy")
public void testMaxUsageCount(Factory factory)