You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@activemq.apache.org by GitBox <gi...@apache.org> on 2020/10/01 19:28:06 UTC

[GitHub] [activemq-artemis] ehsavoie commented on a change in pull request #3204: ARTEMIS-2823 Use datasource with JDBC store db connections

ehsavoie commented on a change in pull request #3204:
URL: https://github.com/apache/activemq-artemis/pull/3204#discussion_r498467162



##########
File path: artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/file/PostgresLargeObjectManager.java
##########
@@ -56,31 +56,31 @@ public PostgresLargeObjectManager(Connection connection) throws SQLException {
       }
    }
 
-   public final Long createLO() throws SQLException {
+   public final Long createLO(Connection connection) throws SQLException {
       if (shouldUseReflection) {
-         Object largeObjectManager = getLargeObjectManager();
+         Object largeObjectManager = getLargeObjectManager(connection);
          try {
-            Method method = largeObjectManager.getClass().getMethod("createLO");
-            return (Long) method.invoke(largeObjectManager);
+            Method method = largeObjectManager.getClass().getMethod("createLO", Connection.class);
+            return (Long) method.invoke(largeObjectManager, connection);

Review comment:
       connection is not a parameter of this method

##########
File path: artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/file/PostgresLargeObjectManager.java
##########
@@ -56,31 +56,31 @@ public PostgresLargeObjectManager(Connection connection) throws SQLException {
       }
    }
 
-   public final Long createLO() throws SQLException {
+   public final Long createLO(Connection connection) throws SQLException {
       if (shouldUseReflection) {
-         Object largeObjectManager = getLargeObjectManager();
+         Object largeObjectManager = getLargeObjectManager(connection);
          try {
-            Method method = largeObjectManager.getClass().getMethod("createLO");
-            return (Long) method.invoke(largeObjectManager);
+            Method method = largeObjectManager.getClass().getMethod("createLO", Connection.class);
+            return (Long) method.invoke(largeObjectManager, connection);
          } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
             throw new SQLException("Couldn't access org.postgresql.largeobject.LargeObjectManager", ex);
          }
       } else {
-         return ((PGConnection) realConnection).getLargeObjectAPI().createLO();
+         return ((PGConnection) unwrap(connection)).getLargeObjectAPI().createLO();
       }
    }
 
-   public Object open(long oid, int mode) throws SQLException {
+   public Object open(Connection connection, long oid, int mode) throws SQLException {
       if (shouldUseReflection) {
-         Object largeObjectManager = getLargeObjectManager();
+         Object largeObjectManager = getLargeObjectManager(connection);
          try {
-            Method method = largeObjectManager.getClass().getMethod("open", long.class, int.class);
-            return method.invoke(largeObjectManager, oid, mode);
+            Method method = largeObjectManager.getClass().getMethod("open", Connection.class, long.class, int.class);
+            return method.invoke(largeObjectManager, connection, oid, mode);

Review comment:
       connection is not a parameter of this method




----------------------------------------------------------------
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.

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