[ 
https://issues.apache.org/jira/browse/PHOENIX-4022?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16105300#comment-16105300
 ] 

James Taylor commented on PHOENIX-4022:
---------------------------------------

Thanks for the updated patch, [~tdsilva]. Here's some feedback:
- Any reason why PhoenixConnectionFactory isn't a static singleton?
- The code in the constructor of PhoenixConnectionFactory shouldn't be 
necessary:
{code}
+    public PhoenixConnectionFactory() {
+        try {
+            Class.forName(PhoenixDriver.class.getName());
+        } catch (Exception e) {
+            logger.error("Cannot load PhoenixDriver", e);
+        }
+    }
{code}
- Can we use the more standard {{Connection conn = 
DriverManager.getConnection(zookeeperQuorum,connectionProperties)}} here to get 
the Connection?
{code}
+    public Connection createPhoenixConnection(String zookeeperQuorum, 
Properties connectionProperties) throws SQLException {
+        StringBuilder sb = new StringBuilder(
+                PhoenixRuntime.JDBC_PROTOCOL + 
PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zookeeperQuorum);
+        sb.append(PhoenixRuntime.JDBC_PROTOCOL_TERMINATOR);
+        final String url = sb.toString();
+        Driver driver = DriverManager.getDriver(url);
+        return driver.connect(url, connectionProperties);
+    }
{code}

> Add PhoenixMetricsLog interface that can be used to log metrics for queries 
> and mutations. 
> -------------------------------------------------------------------------------------------
>
>                 Key: PHOENIX-4022
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-4022
>             Project: Phoenix
>          Issue Type: New Feature
>            Reporter: Thomas D'Silva
>            Assignee: Thomas D'Silva
>             Fix For: 4.12.0
>
>         Attachments: PHOENIX-4022.patch, PHOENIX-4022-v2.patch, 
> PHOENIX-4022-v3.patch, PHOENIX-4022-v4.patch
>
>
> Create a wrapper for PhoenixConnection, PhoenixStatement, 
> PhoenixPreparedStatement and PhoenixResultSet that automatically calls the 
> PhoenixMetricsLog logging methods so users don't have to instrument this 
> themselves.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to