Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PoolSize = 0 does not work #3

Closed
GoogleCodeExporter opened this issue Jun 21, 2015 · 2 comments
Closed

PoolSize = 0 does not work #3

GoogleCodeExporter opened this issue Jun 21, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

Hi,
I'm using furiosObject Pool 1.1. and set the poolsize with this settings :

poolSettings = new PoolSettings<ConnectionPoolSocket>(
...
  });
//  Add some settings
poolSettings.min(0).max(6);     
poolSettings.validateWhenReturn(false);

because I have a Socket Connection inside my pool that rarely used and I want 
to close if is not used.

When test my code with :

ExecutorService threadExecutor = Executors.newFixedThreadPool(4);
for (int i = 0; i < 30; i++) {
        threadExecutor.submit(this);
}       
threadExecutor.shutdown();
try {
  Thread.sleep(60000);
} catch (InterruptedException e) {
}

I see myPool grow correctly to 4 connections but in the sleep time only 3 
connections are closed and 1 is alive.
Any hint to do that ?

Thank you very much and congratulations for the excellent work




Original issue reported on code.google.com by alessand...@gmail.com on 28 Dec 2012 at 10:32

@GoogleCodeExporter
Copy link
Author

The problem is in PoolSettings 

public PoolSettings<T> min(final int min) {
                this.min = min;
                if (maxIdle < min) {
                        maxIdle = min;
                }
                if (max>0 && min > max) {
                        max(min);
                }
                return this;
        }
modifing in 
public PoolSettings<T> min(final int min) {
                this.min = min;
                //if (maxIdle < min) {
                        maxIdle = min;
                //}
                if (max>0 && min > max) {
                        max(min);
                }
                return this;
        }
all works

Original comment by alessand...@gmail.com on 28 Dec 2012 at 1:51

@GoogleCodeExporter
Copy link
Author

Great !
I made the changes.
Thanks

Original comment by eddie.ra...@gmail.com on 27 Feb 2013 at 11:27

  • Changed state: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant