Skip to content

Commit

Permalink
expose connect method for kdb Session
Browse files Browse the repository at this point in the history
rename function to fix naming typo
  • Loading branch information
dzmipt committed Jun 28, 2024
1 parent 888d74b commit 224bada
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/kx/KConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/studio/kdb/Session.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/studio/ui/EditorTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public StudioWindow getStudioWindow() {
return studioWindow;
}

public void setSessonConnection(boolean connected) {
public void setSessionConnection(boolean connected) {
editorPane.setSessionConnected(connected);
}

Expand Down Expand Up @@ -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());

Expand Down

0 comments on commit 224bada

Please sign in to comment.