Skip to content

Commit

Permalink
2 connections for jbrowse
Browse files Browse the repository at this point in the history
  • Loading branch information
Foxcapades committed Oct 22, 2024
1 parent c658365 commit 1cab298
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public JBrowseFeatureDataFactory(WdkModel wdkModel) {
_projectId = wdkModel.getProjectId();
_appDs = wdkModel.getAppDb().getDataSource();
}

public Response featuresAndRegionStats(String refseqName, UriInfo uriInfo, String feature, Long start, Long end) {

// use only first instance of each query param
Expand Down Expand Up @@ -247,9 +247,12 @@ private StreamingOutput getFeaturesOutput(String featureSql, String bulkSubfeatu
return outputStream -> {
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(outputStream));
writer.write("{\"features\":[");
try (Connection conn = _appDs.getConnection()) {
new SQLRunner(conn, sortedFeatureSql, queryName).executeQuery(featureRs -> {
return new SQLRunner(conn, sortedSubfeatureSql, queryName + "_bulk_sub_features").executeQuery(subfeatureRs -> {
try (
Connection con1 = _appDs.getConnection();
Connection con2 = _appDs.getConnection();
) {
new SQLRunner(con1, sortedFeatureSql, queryName).executeQuery(featureRs -> {
return new SQLRunner(con2, sortedSubfeatureSql, queryName + "_bulk_sub_features").executeQuery(subfeatureRs -> {
try {
boolean featureHasAtts = hasColumn(featureRs, "ATTS");
boolean subfeatureHasAtts = hasColumn(subfeatureRs, "ATTS");
Expand Down Expand Up @@ -422,7 +425,7 @@ private static void appendColumnValues(JSONObject myFeature, ResultSet featureRs
if (!INTERNAL_COLUMN_NAMES.contains(colLabel)) {
myFeature.put(colLabel, featureRs.getString(i));
}
}
}
}

private Optional<String> getBulkSubfeatureSql(String feature,
Expand Down

0 comments on commit 1cab298

Please sign in to comment.