From 1cab298653732c7074e1af7a4d01b9cd03b81c22 Mon Sep 17 00:00:00 2001 From: Elizabeth Paige Harper Date: Tue, 22 Oct 2024 15:03:13 -0400 Subject: [PATCH] 2 connections for jbrowse --- .../services/jbrowse/JBrowseFeatureDataFactory.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Service/src/main/java/org/apidb/apicommon/service/services/jbrowse/JBrowseFeatureDataFactory.java b/Service/src/main/java/org/apidb/apicommon/service/services/jbrowse/JBrowseFeatureDataFactory.java index 1a3748d34..08222654b 100644 --- a/Service/src/main/java/org/apidb/apicommon/service/services/jbrowse/JBrowseFeatureDataFactory.java +++ b/Service/src/main/java/org/apidb/apicommon/service/services/jbrowse/JBrowseFeatureDataFactory.java @@ -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 @@ -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"); @@ -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 getBulkSubfeatureSql(String feature,