Skip to content

Commit 12f8290

Browse files
committed
Extract static pool configuration.
1 parent 7a3db14 commit 12f8290

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

smb/src/main/java/ch/cyberduck/core/smb/SMBSession.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,16 +111,19 @@ public String toString() {
111111
}
112112
}
113113

114+
private static final GenericObjectPoolConfig<DiskShareWrapper> config = new GenericObjectPoolConfig<>();
115+
116+
static {
117+
config.setJmxEnabled(false);
118+
config.setBlockWhenExhausted(true);
119+
config.setMaxIdle(1);
120+
config.setMaxTotal(Integer.MAX_VALUE);
121+
config.setTestOnBorrow(true);
122+
}
123+
114124
private final class DiskSharePool extends GenericObjectPool<DiskShareWrapper> {
115125
public DiskSharePool(final String shareName) {
116-
super(new DiskSharePoolObjectFactory(shareName));
117-
final GenericObjectPoolConfig<DiskShareWrapper> config = new GenericObjectPoolConfig<>();
118-
config.setJmxEnabled(false);
119-
config.setBlockWhenExhausted(true);
120-
config.setMaxIdle(1);
121-
config.setMaxTotal(Integer.MAX_VALUE);
122-
config.setTestOnBorrow(true);
123-
this.setConfig(config);
126+
super(new DiskSharePoolObjectFactory(shareName), config);
124127
this.setSwallowedExceptionListener(new SwallowedExceptionListener() {
125128
@Override
126129
public void onSwallowException(final Exception e) {

0 commit comments

Comments
 (0)