-
Notifications
You must be signed in to change notification settings - Fork 1.3k
JB gateway plugin #7362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
JB gateway plugin #7362
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d472d6d
[gitpod-protocol] exposing APIs required for JB integration
akosyakov 63aec27
fixing JB backend plugin
akosyakov 44ecd32
initial commit of Gitpod pugin for JB Gateway
akosyakov ae066f3
switch JB images to use JB Gatway with Gitpod plugin
akosyakov bb29e64
[server] add JB plugins as client types for tracing
akosyakov 3953a45
[supervisor] resume hearbeating if window unload was cancelled
akosyakov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
...ocol/java/src/main/java/io/gitpod/gitpodprotocol/api/BufferingWebSocketMessageWriter.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// Copyright (c) 2022 Gitpod GmbH. All rights reserved. | ||
// Licensed under the GNU Affero General Public License (AGPL). | ||
// See License-AGPL.txt in the project root for license information. | ||
|
||
package io.gitpod.gitpodprotocol.api; | ||
|
||
import org.eclipse.lsp4j.jsonrpc.JsonRpcException; | ||
import org.eclipse.lsp4j.jsonrpc.MessageConsumer; | ||
import org.eclipse.lsp4j.jsonrpc.MessageIssueException; | ||
import org.eclipse.lsp4j.jsonrpc.json.MessageJsonHandler; | ||
import org.eclipse.lsp4j.jsonrpc.messages.Message; | ||
|
||
import javax.websocket.Session; | ||
import java.io.IOException; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.logging.Level; | ||
import java.util.logging.Logger; | ||
|
||
public class BufferingWebSocketMessageWriter implements MessageConsumer { | ||
|
||
private static final Logger LOG = Logger.getLogger(BufferingWebSocketMessageWriter.class.getName()); | ||
|
||
private Session session; | ||
|
||
private final MessageJsonHandler jsonHandler; | ||
private List<String> buffer = new ArrayList<>(); | ||
|
||
public BufferingWebSocketMessageWriter(MessageJsonHandler jsonHandler) { | ||
this.jsonHandler = jsonHandler; | ||
} | ||
|
||
public synchronized void setSession(Session session) { | ||
this.session = session; | ||
if (this.buffer.isEmpty()) { | ||
return; | ||
} | ||
List<String> buffer = this.buffer; | ||
this.buffer = new ArrayList<>(); | ||
for (String msg : buffer) { | ||
this.send(msg); | ||
} | ||
} | ||
|
||
@Override | ||
public synchronized void consume(Message message) throws MessageIssueException, JsonRpcException { | ||
this.send(jsonHandler.serialize(message)); | ||
} | ||
|
||
private void send(String msg) { | ||
if (this.session == null || !this.session.isOpen()) { | ||
this.buffer.add(msg); | ||
return; | ||
} | ||
try { | ||
int length = msg.length(); | ||
if (length <= session.getMaxTextMessageBufferSize()) { | ||
session.getBasicRemote().sendText(msg); | ||
} else { | ||
int currentOffset = 0; | ||
while (currentOffset < length) { | ||
int currentEnd = Math.min(currentOffset + session.getMaxTextMessageBufferSize(), length); | ||
session.getBasicRemote().sendText(msg.substring(currentOffset, currentEnd), currentEnd == length); | ||
currentOffset = currentEnd; | ||
} | ||
} | ||
} catch (IOException e) { | ||
LOG.log(Level.WARNING, "failed to send message", e); | ||
this.buffer.add(msg); | ||
} | ||
} | ||
|
||
} |
62 changes: 0 additions & 62 deletions
62
...nts/gitpod-protocol/java/src/main/java/io/gitpod/gitpodprotocol/api/ConnectionHelper.java
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 0 additions & 23 deletions
23
...nts/gitpod-protocol/java/src/main/java/io/gitpod/gitpodprotocol/api/GitpodClientImpl.java
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...tpod-protocol/java/src/main/java/io/gitpod/gitpodprotocol/api/GitpodServerConnection.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright (c) 2022 Gitpod GmbH. All rights reserved. | ||
// Licensed under the GNU Affero General Public License (AGPL). | ||
// See License-AGPL.txt in the project root for license information. | ||
|
||
package io.gitpod.gitpodprotocol.api; | ||
|
||
import javax.websocket.CloseReason; | ||
import java.util.concurrent.CompletionStage; | ||
import java.util.concurrent.Future; | ||
|
||
public interface GitpodServerConnection extends Future<CloseReason>, CompletionStage<CloseReason> { | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.