chibenwa commented on code in PR #2190:
URL: https://github.com/apache/james-project/pull/2190#discussion_r1567201565


##########
backends-common/postgres/src/main/java/org/apache/james/backends/postgres/utils/PoolBackedPostgresConnectionFactory.java:
##########
@@ -0,0 +1,93 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.james.backends.postgres.utils;
+
+import java.time.Duration;
+import java.util.Optional;
+
+import org.apache.james.core.Domain;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import io.r2dbc.pool.ConnectionPool;
+import io.r2dbc.pool.ConnectionPoolConfiguration;
+import io.r2dbc.spi.Connection;
+import io.r2dbc.spi.ConnectionFactory;
+import reactor.core.publisher.Mono;
+
+public class PoolBackedPostgresConnectionFactory implements 
JamesPostgresConnectionFactory {
+    private static final Logger LOGGER = 
LoggerFactory.getLogger(PoolBackedPostgresConnectionFactory.class);
+    private static final Domain DEFAULT = Domain.of("default");
+    private static final String DEFAULT_DOMAIN_ATTRIBUTE_VALUE = "";
+    private static final int INITIAL_SIZE = 10;
+    private static final int MAX_SIZE = 20;
+    private static final Duration MAX_IDLE_TIME = Duration.ofMillis(5000);
+
+    private final boolean rowLevelSecurityEnabled;
+    private final ConnectionPool pool;
+
+    public PoolBackedPostgresConnectionFactory(boolean 
rowLevelSecurityEnabled, Optional<Integer> maxSize, ConnectionFactory 
connectionFactory) {
+        this.rowLevelSecurityEnabled = rowLevelSecurityEnabled;
+        final ConnectionPoolConfiguration configuration = 
ConnectionPoolConfiguration.builder(connectionFactory)

Review Comment:
   We tend generally not to make the code unreadable with final variables as we 
never reassign variables in the first place.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org
For additional commands, e-mail: notifications-h...@james.apache.org

Reply via email to