terrymanu commented on a change in pull request #3165: Support time server
database for issues 1497
URL:
https://github.com/apache/incubator-shardingsphere/pull/3165#discussion_r330528061
##########
File path:
sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/communication/jdbc/connection/BackendConnection.java
##########
@@ -316,4 +321,45 @@ private void replayMethodsInvocation(final Object target)
{
each.invoke(target);
}
}
+
+ public Optional<Connection> getTimeServerConnection(){
+ String timeServerDataSourceName = logicSchema.getShardingRule()
+ .getShardingDataSourceNames().getTimeServerDataSourceName();
+ if (timeServerDataSourceName == null) {
+ timeServerDataSourceName =
logicSchema.getShardingRule().getShardingDataSourceNames().getDefaultDataSourceName();
+ }
+ try {
+ Connection connection = timeServerDataSourceName == null
+ ?
logicSchema.getBackendDataSource().getDataSources().entrySet().iterator().next().getValue().getConnection()
+ :
logicSchema.getBackendDataSource().getConnection(timeServerDataSourceName);
+ return Optional.fromNullable(connection);
+ } catch (SQLException e) {
+ return Optional.absent();
+ }
+ }
+
+
Review comment:
Only one empty line permit during 2 methods.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services