-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: limitless - reduce extraneous conns made on first connection + s…
…hift connection logic from plugin to service class
- Loading branch information
1 parent
404f588
commit ae5ff77
Showing
7 changed files
with
673 additions
and
480 deletions.
There are no files selected for viewing
75 changes: 75 additions & 0 deletions
75
wrapper/src/main/java/software/amazon/jdbc/plugin/limitless/LimitlessConnectionContext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed 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 software.amazon.jdbc.plugin.limitless; | ||
|
||
import java.sql.Connection; | ||
import java.sql.SQLException; | ||
import java.util.List; | ||
import java.util.Properties; | ||
import org.checkerframework.checker.nullness.qual.NonNull; | ||
import software.amazon.jdbc.HostSpec; | ||
import software.amazon.jdbc.JdbcCallable; | ||
|
||
public class LimitlessConnectionContext { | ||
private HostSpec hostSpec; | ||
private Properties props; | ||
private Connection connection; | ||
private JdbcCallable<Connection, SQLException> connectFunc; | ||
private List<HostSpec> limitlessRouters; | ||
|
||
public LimitlessConnectionContext( | ||
final HostSpec hostSpec, | ||
final Properties props, | ||
final Connection connection, | ||
final JdbcCallable<Connection, SQLException> connectFunc, | ||
final List<HostSpec> limitlessRouters | ||
) { | ||
this.hostSpec = hostSpec; | ||
this.props = props; | ||
this.connection = connection; | ||
this.connectFunc = connectFunc; | ||
this.limitlessRouters = limitlessRouters; | ||
} | ||
|
||
public HostSpec getHostSpec() { | ||
return this.hostSpec; | ||
} | ||
|
||
public Properties getProps() { | ||
return this.props; | ||
} | ||
|
||
public Connection getConnection() { | ||
return this.connection; | ||
} | ||
|
||
public void setConnection(final @NonNull Connection connection) { | ||
this.connection = connection; | ||
} | ||
|
||
public JdbcCallable<Connection, SQLException> getConnectFunc() { | ||
return this.connectFunc; | ||
} | ||
|
||
public List<HostSpec> getLimitlessRouters() { | ||
return this.limitlessRouters; | ||
} | ||
|
||
public void setLimitlessRouters(final @NonNull List<HostSpec> limitlessRouters) { | ||
this.limitlessRouters = limitlessRouters; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.