{"id":37029407,"url":"https://github.com/woostju/ssh-client-pool","last_synced_at":"2026-01-14T03:31:40.808Z","repository":{"id":47771770,"uuid":"258991039","full_name":"woostju/ssh-client-pool","owner":"woostju","description":"a java implementation of ssh clients object pool with sshj, apache common pool2, expectIt","archived":false,"fork":false,"pushed_at":"2021-08-13T15:36:26.000Z","size":88,"stargazers_count":20,"open_issues_count":4,"forks_count":11,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-15T16:49:42.483Z","etag":null,"topics":["interactive","java","pool","ssh-client"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/woostju.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-26T09:32:33.000Z","updated_at":"2025-05-06T09:40:15.000Z","dependencies_parsed_at":"2022-09-02T06:54:37.103Z","dependency_job_id":null,"html_url":"https://github.com/woostju/ssh-client-pool","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/woostju/ssh-client-pool","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/woostju%2Fssh-client-pool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/woostju%2Fssh-client-pool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/woostju%2Fssh-client-pool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/woostju%2Fssh-client-pool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/woostju","download_url":"https://codeload.github.com/woostju/ssh-client-pool/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/woostju%2Fssh-client-pool/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408843,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["interactive","java","pool","ssh-client"],"created_at":"2026-01-14T03:31:40.065Z","updated_at":"2026-01-14T03:31:40.786Z","avatar_url":"https://github.com/woostju.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ssh-client-pool\na java implementation of ssh clients object pool with [sshj](https://github.com/hierynomus/sshj), [apache common pool2](https://github.com/apache/commons-pool), [expectIt](https://github.com/Alexey1Gavrilov/ExpectIt)\n\n\n\n## usage\n\nssh-client-pool is available from **Maven Central**\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.github.woostju\u003c/groupId\u003e\n  \u003cartifactId\u003essh-client-pool\u003c/artifactId\u003e\n  \u003cversion\u003e1.0.1-RELEASE\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n### Who is this for?\n\nAnyone who wants to connect server instances through SSH, send commands to server and consume the output continuously. \n\nAnyone who wants to cache the connected clients in an object pool, to reuse the client.\n\n\n### How do I use this?\n\nThe SshClientsPool is auto-configured, use it directly as:\n\n```java\n\n@Autowired\nSshClientsPool pool;\n\npublic void echo(){\n\tSshClientConfig clientConfig = new SshClientConfig(\"hostip\", 22, \"username\", \"password\", null);\n\tSshClientWrapper client = pool.client(clientConfig);\n\tSshResponse response = client.executeCommand(\"echo 'hi'\", 100);\n\treturn response;\n}\n\n```\n\n### Can I configure the pool?\n\nYou can configure SshClientsPool in your SpringBoot properties file as:\n\n```\nwoostju.ssh-client-pool.maxActive=16\nwoostju.ssh-client-pool.maxIdle=16\nwoostju.ssh-client-pool.idleTime=20000\nwoostju.ssh-client-pool.maxWait=20000\n```\n\nwhat's more, you can also register the SshClientsPool yourself:\n\n ```java\n@Bean\npublic SshClientsPool sshclientpool() {\n\tSshClientPoolConfig poolConfig = SshClientPoolConfig();\n\tpoolConfig.setMaxTotalPerKey(maxTotal);\n\tpoolConfig.setMaxIdlePerKey(maxIdle); \n\tpoolConfig.setBlockWhenExhausted(true);\n\tpoolConfig.setMaxWaitMillis(1000L * maxWaitMillis); \n\t\t\n\tpoolConfig.setMinEvictableIdleTimeMillis(1000L * idleTime); \n\tpoolConfig.setTimeBetweenEvictionRunsMillis(1000L * idleTime);\n\tpoolConfig.setTestOnBorrow(true); \n\tpoolConfig.setTestOnReturn(true); \n\tpoolConfig.setTestWhileIdle(true);\n\tpoolConfig.setJmxEnabled(false); //disbale jmx\n\t\n\treturn new SshClientsPool(poolConfig);\n}\n```\n\nSshClientPoolConfig is a subclass of GenericKeyedObjectPool in Apacha Common Pool2, learn more from [apache common pool2](https://github.com/apache/commons-pool) to configure the pool.\n\n### How does it work?\n\nWhen you request a client from pool, it will pull an idle one, if there is no idle client, a created one return.\nAfter you execute a command, it will return the client to pool as an idle one.\nIf you close the client explicitly, the client will be destroyed and remove from pool.\n\n## License\n\nThis code is under the [Apache Licence v2](https://www.apache.org/licenses/LICENSE-2.0).\n\n\n## Additional Resources\n\n* [hierynomus/sshj](https://github.com/hierynomus/sshj)  ssh, scp and sftp for java\n* [apache common pool2](https://github.com/apache/commons-pool)  The Apache Commons Object Pooling Library.\n* [Alexey1Gavrilov/expectIt](https://github.com/Alexey1Gavrilov/ExpectIt)  ExpectIt - is yet another pure Java 1.6+ implementation of the Expect tool. It is designed to be simple, easy to use and extensible. Written from scratch.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwoostju%2Fssh-client-pool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwoostju%2Fssh-client-pool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwoostju%2Fssh-client-pool/lists"}