Skip to main content



      Home
Home » Eclipse Projects » EGit / JGit » Fetch via SSH, but keep connection open(Fetch via SSH transport without closing connection)
Fetch via SSH, but keep connection open [message #1863564] Fri, 09 February 2024 17:09 Go to next message
Eclipse UserFriend
Hi all, I am using JGit in an Android app and it works well.

I am looking for a way to run a fetch command over SSH and then leave the connection open, instead of immediately disconnecting. I often want to do a push very soon afterwards, and negotiating a new SSH session takes time. If the session was not closed by the Transport code, I would be able to reuse it.

SSH multiplexing would probably solve this, but I can't find any indication that the Apache MINA SSHD library supports it. Does anyone know for sure?

If I could override the SshTransport implementation of close(), I would, but I don't know a good way to do that. It seems I would need to recreate so many utility functions. But my experience with Java is very limited.

Does anyone have pointers on a good way to solve this? Thank you very much in advance.

[Updated on: Sat, 10 February 2024 02:51] by Moderator

Re: Fetch via SSH, but keep connection open [message #1863593 is a reply to message #1863564] Wed, 14 February 2024 06:40 Go to previous message
Eclipse UserFriend
I solved it by defining my own SshSessionFactory with overrides for methods releaseSession() and getSession(). I then used AutoCloseable and try-with-resources to persist this SshSessionFactory for as long as I need it.

Code: https://github.com/amberin/orgzly-community/commit/e04a90fabb456f370ac249c4ae39b02805f0cf0e#diff-6addb647bf2eb2fb5927ee5da627c87370bc27946a2d15235a447c2beec9c736
Previous Topic:how to compare two LOCAL branch and then copy the content from one branch to another
Next Topic:EGIT gets a connection reset from azure
Goto Forum:
  


Current Time: Wed May 14 18:14:07 EDT 2025

Powered by FUDForum. Page generated in 0.27289 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top