From 224bada51a3273d84616468ed062fed1f0765352 Mon Sep 17 00:00:00 2001 From: dzmipt Date: Fri, 28 Jun 2024 13:08:02 +0200 Subject: [PATCH] expose connect method for kdb Session rename function to fix naming typo --- src/kx/KConnection.java | 6 ++++-- src/studio/kdb/Session.java | 2 +- src/studio/ui/EditorTab.java | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/kx/KConnection.java b/src/kx/KConnection.java index b735d5fe..277462e6 100755 --- a/src/kx/KConnection.java +++ b/src/kx/KConnection.java @@ -69,7 +69,9 @@ public boolean isClosed() { return closed; } - private void connect() throws IOException, K4AccessException { + public synchronized void connect() throws IOException, K4AccessException { + if ( !closed ) return; + String userPassword = authentication == null ? "" : authentication.getUserPassword(); s = new Socket(); s.setReceiveBufferSize(1024 * 1024); @@ -141,7 +143,7 @@ private long send(K.KBase query) throws IOException { public synchronized KMessage k(K.KBase x, ProgressCallback progress) throws K4Exception, IOException, InterruptedException { try { - if (isClosed()) connect(); + connect(); // will do nothing if it is already connected socketReader.setProgressCallback(progress); K.KTimestamp sentTime = K.KTimestamp.now(); long sentBytes = send(x); diff --git a/src/studio/kdb/Session.java b/src/studio/kdb/Session.java index cc281e0d..ceb51862 100644 --- a/src/studio/kdb/Session.java +++ b/src/studio/kdb/Session.java @@ -62,7 +62,7 @@ public void removeTab(EditorTab editor) { @Override public void connectionStateChange(boolean connected) { for(EditorTab editor: editors) { - editor.setSessonConnection(connected); + editor.setSessionConnection(connected); } } diff --git a/src/studio/ui/EditorTab.java b/src/studio/ui/EditorTab.java index 84c40c55..1c92d10c 100644 --- a/src/studio/ui/EditorTab.java +++ b/src/studio/ui/EditorTab.java @@ -155,7 +155,7 @@ public StudioWindow getStudioWindow() { return studioWindow; } - public void setSessonConnection(boolean connected) { + public void setSessionConnection(boolean connected) { editorPane.setSessionConnected(connected); } @@ -255,7 +255,7 @@ public void setServer(Server server) { } this.server = server; session = Session.newSession(this); - setSessonConnection(!session.isClosed()); + setSessionConnection(!session.isClosed()); getTextArea().setBackground(server.getBackgroundColor());