Giter Club home page Giter Club logo

vibur-object-pool's People

Contributors

nwolff avatar simeonmalchev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

vibur-object-pool's Issues

Initialize the initial objects in parallel

The current source code is pretty straight forward:

        for (int i = 0; i < initialSize; i++) {
            available.offerLast(requireNonNull(poolObjectFactory.create()));
            createdTotal.incrementAndGet();
        }

However if creating an pooled object takes one second and the initial size is ten it takes roughly ten seconds for the pool to be initialized. Creating it in parallel could boost the initializing time.

disruptor should be optional=true, not scope=provided

Hi, I'm just going by the description in your maven POM:

<!-- Disruptor dependency will be used only if MultithreadConcurrentQueueCollection
             is injected as a ConcurrentCollection in ConcurrentPool. If the client's application
             wants to use and inject MCQC, it needs to provide the below dependency. -->
        <dependency>
            <groupId>com.conversantmedia</groupId>
            <artifactId>disruptor</artifactId>
            <version>${disruptor.version}</version>
            <scope>provided</scope>
        </dependency>

That means it should have <optional>true</optional> instead of <scope>provided</scope>. With provided scope, you tell maven (and static code analysers) that you have an always-on dependency that you assume will be provided by the end-user. But if I read your comment, it is actually an optional dependency the end-user can provide.

About objects housekeeping/maintenance (keep alive)

Hi @simeonmalchev,

Firstly, congratulations for your objects pool implementation and thanks for publishing it; it's by far the cleanest & simplest I have found (including Apache Commons').

Here at Caravelo we are trying to use it to implement a connections pool to an Airlines Reservation System.

One of our requirements is that the idle connections must be kept alive before they expire (since they are expensive to create). Pardon me if I'm too naive, but do so I'm thinking of some sort of housekeeping scheduled task which does the following:

  1. drain all the idle connections
  2. send a keep alive request to the reservation system for each connection
  3. return the connections to the pool

I'm aware that Vibur Object Pool supports items validation through the PoolObjectFactory, however I'm afraid this would not be enough to meet the requirement I have just described. Can you provide some advice in this regard?

If it's not possible to do with Vibur Object Pool as of today, I'm thinking of forking the repository, adding housekeeping support (ideally following your indications/specs) and then send you a pull request.

I'll be awaiting your feedback.

Cheers.

tryTake(long, TimeUnit) doesn't behave like expected โ€“ not returning NULL after waiting period

If the minimum size for the pool is zero the method tryTake(long, TimeUnit) will create a new pooled "Object". If this creation got stuck the method will not return anything indefinitely.

This is the opposite of the JavaDoc: "@return an object taken from the object pool or {@code null} if the specified timeout expires or if it was interrupted while waiting".
Either the JavaDoc should be edited or the process of object creation should be limited to the waiting period, too.

Expire objects in pool after a timeout

Hi, nice component,

is there a way to auto remove the object from pool ?

For instance, after 5 seconds that the object is not used check for remove it from the pool and remove it.

Thanks

Closing Pool: Maximum permit count exceeded

When I'm closing the pool after usage following exception is thrown:

Caused by: java.lang.Error: Maximum permit count exceeded
	at java.util.concurrent.Semaphore$Sync.tryReleaseShared(Semaphore.java:192)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.releaseShared(AbstractQueuedSynchronizer.java:1341)
	at java.util.concurrent.Semaphore.release(Semaphore.java:609)
	at org.vibur.objectpool.ConcurrentPool.terminate(ConcurrentPool.java:405)
	at org.vibur.objectpool.ConcurrentPool.close(ConcurrentPool.java:410)

Pool Creation:

new ConcurrentPool<>(new ConcurrentLinkedQueueCollection<>(), new SourceItemFactory(), 128 * 6, Integer.MAX_VALUE,
            false);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.