io.vlingo.xoom.common.pool.AbstractResourcePool Maven / Gradle / Ivy
// Copyright © 2012-2021 VLINGO LABS. All rights reserved.
//
// This Source Code Form is subject to the terms of the
// Mozilla Public License, v. 2.0. If a copy of the MPL
// was not distributed with this file, You can obtain
// one at https://mozilla.org/MPL/2.0/.
package io.vlingo.xoom.common.pool;
/**
* An abstract {@link ResourcePool} that implements {@link ResourcePool#acquire()}
* using the default arguments from {@link ResourceFactory#defaultArguments()}.
*
* @param the type of the pooled resource
* @param the type of the arguments to the acquire method
*/
abstract class AbstractResourcePool implements ResourcePool {
final ResourceFactory factory;
AbstractResourcePool(ResourceFactory factory) {
this.factory = factory;
}
/**
* Uses {@link ResourceFactory#defaultArguments()} to {@link ResourcePool#acquire(Object)} a resource object.
*
* @return a resource object with default arguments
* @see ResourceFactory#defaultArguments()
*/
@Override
public Resource acquire() {
return acquire(factory.defaultArguments());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy