Skip to content
This repository has been archived by the owner on Apr 16, 2022. It is now read-only.

Commit

Permalink
Review language about max http connections conf setting (#757)
Browse files Browse the repository at this point in the history
- Outside CommonsHttp, we use "max http connections"
- Inside CommonsHttp, we use "max connections"
- For user-facing texts, we use "maximum simultaneous HTTP connections"
  • Loading branch information
ggalmazor authored Jul 3, 2019
1 parent 65e2095 commit 5bc43ed
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/org/opendatakit/briefcase/operations/Common.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class Common {
static final Param<String> ODK_USERNAME = Param.arg("u", "odk_username", "ODK Username");
static final Param<String> ODK_PASSWORD = Param.arg("p", "odk_password", "ODK Password");
static final Param<String> AGGREGATE_SERVER = Param.arg("url", "aggregate_url", "Aggregate server URL");
public static final Param<Integer> MAX_HTTP_CONNECTIONS = Param.arg("mhc", "max_http_connections", "Maximum HTTP simultaneous connections (defaults to 8)", Integer::parseInt);
public static final Param<Integer> MAX_HTTP_CONNECTIONS = Param.arg("mhc", "max_http_connections", "Maximum simultaneous HTTP connections (defaults to 8)", Integer::parseInt);

static Path getOrCreateBriefcaseDir(String storageDir) {
Path briefcaseDir = BriefcasePreferences.buildBriefcaseDir(Paths.get(storageDir));
Expand Down
6 changes: 3 additions & 3 deletions src/org/opendatakit/briefcase/operations/Export.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ public static void export(String storageDir, String formid, Path exportDir, Stri
BriefcasePreferences exportPrefs = BriefcasePreferences.forClass(ExportPanel.class);
BriefcasePreferences pullPrefs = BriefcasePreferences.forClass(ExportPanel.class);

int maxConnections = appPreferences.getMaxHttpConnections().orElse(DEFAULT_HTTP_CONNECTIONS);
int maxHttpConnections = appPreferences.getMaxHttpConnections().orElse(DEFAULT_HTTP_CONNECTIONS);
Http http = appPreferences.getHttpProxy()
.map(host -> CommonsHttp.of(maxConnections, host))
.orElseGet(() -> CommonsHttp.of(maxConnections));
.map(host -> CommonsHttp.of(maxHttpConnections, host))
.orElseGet(() -> CommonsHttp.of(maxHttpConnections));

Optional<BriefcaseFormDefinition> maybeFormDefinition = formCache.getForms().stream()
.filter(form -> form.getFormId().equals(formid))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public class PullFormFromAggregate {
Arrays.asList(RESUME_LAST_PULL, INCLUDE_INCOMPLETE, FORM_ID, START_FROM_DATE, MAX_HTTP_CONNECTIONS)
);

public static void pullFormFromAggregate(String storageDir, Optional<String> formId, String username, String password, String server, boolean resumeLastPull, Optional<LocalDate> startFromDate, boolean includeIncomplete, Optional<Integer> maybeMaxConnections) {
public static void pullFormFromAggregate(String storageDir, Optional<String> formId, String username, String password, String server, boolean resumeLastPull, Optional<LocalDate> startFromDate, boolean includeIncomplete, Optional<Integer> maybeMaxHttpConnections) {
CliEventsCompanion.attach(log);
Path briefcaseDir = Common.getOrCreateBriefcaseDir(storageDir);
FormCache formCache = FormCache.from(briefcaseDir);
Expand All @@ -87,13 +87,13 @@ public static void pullFormFromAggregate(String storageDir, Optional<String> for
appPreferences.setStorageDir(briefcaseDir);
BriefcasePreferences tabPreferences = BriefcasePreferences.forClass(PullPanel.class);

int maxConnections = Optionals.race(
maybeMaxConnections,
int maxHttpConnections = Optionals.race(
maybeMaxHttpConnections,
appPreferences.getMaxHttpConnections()
).orElse(DEFAULT_HTTP_CONNECTIONS);
Http http = appPreferences.getHttpProxy()
.map(host -> CommonsHttp.of(maxConnections, host))
.orElseGet(() -> CommonsHttp.of(maxConnections));
.map(host -> CommonsHttp.of(maxHttpConnections, host))
.orElseGet(() -> CommonsHttp.of(maxHttpConnections));

AggregateServer aggregateServer = AggregateServer.authenticated(RequestBuilder.url(server), new Credentials(username, password));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ private static void pushFormToAggregate(String storageDir, String formid, String
formCache.update();
BriefcasePreferences appPreferences = BriefcasePreferences.appScoped();

int maxConnections = Optionals.race(
int maxHttpConnections = Optionals.race(
maybeMaxConnections,
appPreferences.getMaxHttpConnections()
).orElse(DEFAULT_HTTP_CONNECTIONS);
Http http = appPreferences.getHttpProxy()
.map(host -> CommonsHttp.of(maxConnections, host))
.orElseGet(() -> CommonsHttp.of(maxConnections));
.map(host -> CommonsHttp.of(maxHttpConnections, host))
.orElseGet(() -> CommonsHttp.of(maxHttpConnections));

AggregateServer aggregateServer = AggregateServer.authenticated(RequestBuilder.url(server), new Credentials(username, password));

Expand Down
6 changes: 3 additions & 3 deletions src/org/opendatakit/briefcase/ui/MainBriefcaseWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ private MainBriefcaseWindow() {
analytics.enter("Briefcase");
Runtime.getRuntime().addShutdownHook(new Thread(() -> analytics.leave("Briefcase")));

int maxConnections = appPreferences.getMaxHttpConnections().orElse(DEFAULT_HTTP_CONNECTIONS);
int maxHttpConnections = appPreferences.getMaxHttpConnections().orElse(DEFAULT_HTTP_CONNECTIONS);
Http http = appPreferences.getHttpProxy()
.map(host -> CommonsHttp.of(maxConnections, host))
.orElseGet(() -> CommonsHttp.of(maxConnections));
.map(host -> CommonsHttp.of(maxHttpConnections, host))
.orElseGet(() -> CommonsHttp.of(maxHttpConnections));

frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@
<gridbag weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<text value="Maximum HTTP simultaneous connections"/>
<text value="Maximum simultaneous HTTP connections"/>
</properties>
</component>
<hspacer id="b75ef">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ private void createUIComponents() {
gbc.fill = GridBagConstraints.HORIZONTAL;
maxHttpConnectionContainer.add(maxHttpConnectionsField, gbc);
maxHttpConnectionsLabel = new JLabel();
maxHttpConnectionsLabel.setText("Maximum HTTP simultaneous connections");
maxHttpConnectionsLabel.setText("Maximum simultaneous HTTP connections");
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
Expand Down

0 comments on commit 5bc43ed

Please sign in to comment.