You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I read the source code, I executed connectionBag. add (poolEntry) in the call method of PoolEntry Creator; Afterwards, it will sleep the current thread for 30 seconds and quietsleep (30);
I think this is not appropriate. We should expose this parameter to HikariConfig and default it to 30 in the constructor. The user can decide the sleep time themselves through the set method. The code is as follows:
step1:Add the quietlySleepTime property to the HikariConfig class,the code is as follows
`
public class HikariConfig implements HikariConfigMXBean
private static final long QUIETLY_SLEEP_TIME = 30L;
private long quietlySleepTime;
public HikariConfig()
{
......
quietlySleepTime = QUIETLY_SLEEP_TIME;
......
}
public void setQuietlySleepTime(long quietlySleepTime) {
this.quietlySleepTime = quietlySleepTime;
}
}
`
step2:Simply reference this property in the call method of PoolElementCreator,the code is as follows
`
private final class PoolEntryCreator implements Callable
{
@Override
public Boolean call()
{
var backoffMs = 10L;
var added = false;
try {
while (shouldContinueCreating()) {
final var poolEntry = createPoolEntry();
if (poolEntry != null) {
......
quietlySleep(config.getQuietlySleepTime());
break;
}
}
}
finally {
if (added && loggingPrefix != null)
logPoolState(loggingPrefix);
else if (!added)
logPoolState("Connection not added, ");
}
// Pool is suspended, shutdown, or at max size
return Boolean.FALSE;
}
}
` step3:user can config this param in HikariConfig
`
HikariConfig hikariConfig = new HikariConfig();
......
hikariConfig.setQuietlySleepTime(60);
......
return new HikariDataSource(hikariConfig);
`
The text was updated successfully, but these errors were encountered:
When I read the source code, I executed connectionBag. add (poolEntry) in the call method of PoolEntry Creator; Afterwards, it will sleep the current thread for 30 seconds and quietsleep (30);
I think this is not appropriate. We should expose this parameter to HikariConfig and default it to 30 in the constructor. The user can decide the sleep time themselves through the set method. The code is as follows:
step1:Add the quietlySleepTime property to the HikariConfig class,the code is as follows
`
public class HikariConfig implements HikariConfigMXBean
}
}
`
step2:Simply reference this property in the call method of PoolElementCreator,the code is as follows
`
private final class PoolEntryCreator implements Callable
{
}
`
step3:user can config this param in HikariConfig
`
HikariConfig hikariConfig = new HikariConfig();
......
hikariConfig.setQuietlySleepTime(60);
......
return new HikariDataSource(hikariConfig);
`
The text was updated successfully, but these errors were encountered: