Skip to content

Commit

Permalink
Simplify reactive pool size configuration
Browse files Browse the repository at this point in the history
Follow-up of quarkusio#30801
  • Loading branch information
gsmet committed Feb 4, 2023
1 parent 46511e3 commit 9be74d9
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ public class DataSourceReactiveRuntimeConfig {
/**
* The datasource pool maximum size.
*/
@ConfigItem(defaultValueDocumentation = "20")
public OptionalInt maxSize = OptionalInt.empty();
@ConfigItem(defaultValue = "20")
public int maxSize = 20;

/**
* When a new connection object is created, the pool assigns it an event loop.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,7 @@ private PoolOptions toPoolOptions(Integer eventLoopCount,
PoolOptions poolOptions;
poolOptions = new PoolOptions();

if (dataSourceReactiveRuntimeConfig.maxSize.isPresent()) {
poolOptions.setMaxSize(dataSourceReactiveRuntimeConfig.maxSize.getAsInt());
} else {
poolOptions.setMaxSize(20);
}
poolOptions.setMaxSize(dataSourceReactiveRuntimeConfig.maxSize);

if (dataSourceReactiveRuntimeConfig.idleTimeout.isPresent()) {
int idleTimeout = Math.toIntExact(dataSourceReactiveRuntimeConfig.idleTimeout.get().toMillis());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,7 @@ private PoolOptions toPoolOptions(Integer eventLoopCount,
PoolOptions poolOptions;
poolOptions = new PoolOptions();

if (dataSourceReactiveRuntimeConfig.maxSize.isPresent()) {
poolOptions.setMaxSize(dataSourceReactiveRuntimeConfig.maxSize.getAsInt());
} else {
poolOptions.setMaxSize(20);
}
poolOptions.setMaxSize(dataSourceReactiveRuntimeConfig.maxSize);

if (dataSourceReactiveRuntimeConfig.idleTimeout.isPresent()) {
int idleTimeout = Math.toIntExact(dataSourceReactiveRuntimeConfig.idleTimeout.get().toMillis());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,7 @@ private PoolOptions toPoolOptions(Integer eventLoopCount,
PoolOptions poolOptions;
poolOptions = new PoolOptions();

if (dataSourceReactiveRuntimeConfig.maxSize.isPresent()) {
poolOptions.setMaxSize(dataSourceReactiveRuntimeConfig.maxSize.getAsInt());
} else {
poolOptions.setMaxSize(20);
}
poolOptions.setMaxSize(dataSourceReactiveRuntimeConfig.maxSize);

if (dataSourceReactiveRuntimeConfig.idleTimeout.isPresent()) {
int idleTimeout = Math.toIntExact(dataSourceReactiveRuntimeConfig.idleTimeout.get().toMillis());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,7 @@ private PoolOptions toPoolOptions(Integer eventLoopCount,
PoolOptions poolOptions;
poolOptions = new PoolOptions();

if (dataSourceReactiveRuntimeConfig.maxSize.isPresent()) {
poolOptions.setMaxSize(dataSourceReactiveRuntimeConfig.maxSize.getAsInt());
} else {
poolOptions.setMaxSize(20);
}
poolOptions.setMaxSize(dataSourceReactiveRuntimeConfig.maxSize);

if (dataSourceReactiveRuntimeConfig.idleTimeout.isPresent()) {
int idleTimeout = Math.toIntExact(dataSourceReactiveRuntimeConfig.idleTimeout.get().toMillis());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,7 @@ private PoolOptions toPoolOptions(Integer eventLoopCount,
PoolOptions poolOptions;
poolOptions = new PoolOptions();

if (dataSourceReactiveRuntimeConfig.maxSize.isPresent()) {
poolOptions.setMaxSize(dataSourceReactiveRuntimeConfig.maxSize.getAsInt());
} else {
poolOptions.setMaxSize(20);
}
poolOptions.setMaxSize(dataSourceReactiveRuntimeConfig.maxSize);

if (dataSourceReactiveRuntimeConfig.idleTimeout.isPresent()) {
int idleTimeout = Math.toIntExact(dataSourceReactiveRuntimeConfig.idleTimeout.get().toMillis());
Expand Down

0 comments on commit 9be74d9

Please sign in to comment.