{"id":17881311,"url":"https://github.com/col-e/instrumentationserver","last_synced_at":"2026-04-01T17:02:18.909Z","repository":{"id":53375475,"uuid":"494722019","full_name":"Col-E/InstrumentationServer","owner":"Col-E","description":"Minimal client-server library for interacting with remote JVM instrumentation instances","archived":false,"fork":false,"pushed_at":"2025-07-01T03:20:54.000Z","size":254,"stargazers_count":17,"open_issues_count":3,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-03-27T23:42:21.747Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Col-E.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-05-21T08:15:48.000Z","updated_at":"2025-07-31T13:21:08.000Z","dependencies_parsed_at":"2024-04-30T22:43:45.582Z","dependency_job_id":"c2a58fb5-a237-4f03-b5a8-5ee83b3fb994","html_url":"https://github.com/Col-E/InstrumentationServer","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/Col-E/InstrumentationServer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Col-E%2FInstrumentationServer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Col-E%2FInstrumentationServer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Col-E%2FInstrumentationServer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Col-E%2FInstrumentationServer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Col-E","download_url":"https://codeload.github.com/Col-E/InstrumentationServer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Col-E%2FInstrumentationServer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31290538,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T13:12:26.723Z","status":"ssl_error","status_checked_at":"2026-04-01T13:12:25.102Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2024-10-28T12:36:34.488Z","updated_at":"2026-04-01T17:02:18.874Z","avatar_url":"https://github.com/Col-E.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Instrumentation Server [![](https://jitpack.io/v/Col-E/InstrumentationServer.svg)](https://jitpack.io/#Col-E/InstrumentationServer)\n\nA minimal client-server library that allows simple interaction with a remote process's `Instrumentation` API over a message system.\n\n## Usage\n\nMaven dependency:\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003esoftware.coley\u003c/groupId\u003e\n    \u003cartifactId\u003einstrumentation-server\u003c/artifactId\u003e\n    \u003cversion\u003e${serverVersion}\u003c/version\u003e \u003c!-- See release page for latest version --\u003e\n\u003c/dependency\u003e\n```\n\nGradle dependency:\n```groovy\nimplementation group: 'software.coley', name: 'instrumentation-server', version: serverVersion\nimplementation \"software.coley:instrumentation-server:${serverVersion}\"\n```\n\n### Starting a new process\n\nExample logic to programmatically launch a new process with the agent active:\n```java\n// Extract the agent jar to some path\nPath agentJarPath = // ...\nExtractor.extractToPath(agentJarPath);\n\n// Start new process\nString agent = \"-javaagent:\" + agentJarPath.toString().replace(\"\\\\\", \"/\");\nProcess remote = new ProcessBuilder(\"java\", agent, \"-cp\", \"\u003cclasspath\u003e\", \"\u003cmain-class\u003e\").start();\n\n// Connect\nint port = Server.DEFAULT_PORT;\nClient client = new Client(\"127.0.0.1\", port, ByteBufferAllocator.HEAP, MessageFactory.create());\nif (!client.connect()) System.err.println(\"Connect failed!\");\n```\n\n### Connecting to an existing process\n\nExample logic to programmatically connect to an existing JVM and load the agent:\n```java\n// Extract the agent jar to some path\nPath agentJarPath = // ...\nExtractor.extractToPath(agentJarPath);\n\n// Use attach API to connect to remote VM.\n// Options string is optional, but can be used to run the server on a unique port.\nint openPort = SocketAvailability.findAvailable();\nString optionsStr = \"port=\" + openPort;\nfor (VirtualMachineDescriptor descriptor : VirtualMachine.list()) {\n    // Filter to only apply to a target VM\n    if (!match(descriptor)) continue;\n    // Attach to the VM\n    try {\n        descriptor.provider().attachVirtualMachine(descriptor)\n                .loadAgent(agentJarPath.toAbsolutePath().toString(), optionsStr);\n    } catch (AgentLoadException e) {\n        e.printStackTrace();\n    } catch (AgentInitializationException e) {\n        e.printStackTrace();\n    } catch (IOException e) {\n        e.printStackTrace();\n    } catch (AttachNotSupportedException e) {\n        e.printStackTrace();\n    }\n}\n\n// Connect\nClient client = new Client(\"127.0.0.1\", openPort, ByteBufferAllocator.HEAP);\nif (!client.connect()) System.err.println(\"Connect failed!\");\n\n// Send request + handle reply\nMemberData memberData = new MemberData(\"java/lang/Integer\", \"MAX_VALUE\", \"I\");\nclient.sendBlocking(new RequestFieldGetMessage(memberData), reply -\u003e {\n    // reply is asserted to be ReplyFieldGetMessage\n    System.out.println(reply.getValueText());\n});\n\n// Handle general broadcasts\nclient.setBroadcastListener((type, message) -\u003e { });\n```\n\n### API\n\nThe `Client` class has four primary methods:\n\n| Method                                                                                               | Usage |\n|------------------------------------------------------------------------------------------------------|-------|\n| `WriteResult sendAsync(AbstractMessage message)`                                                     | Send a `AbstractMessage` value, return wrapper of of write operation information. |\n| `ReplyResult sendAsync(AbstractRequestMessage message, Consumer\u003cAbstractReplyMessage\u003e replyHandler)` | Send a `AbstractMessage` value and handle a reply value _(ideally of an expected type)_, return wrapper of the write operation and read operation for the handled response. |\n| `void sendBlocking(AbstractMessage message)`                                                         | Send a `AbstractMessage` value, return when the message has been sent. |\n| `void sendBlocking(AbstractRequestMessage message, Consumer\u003cAbstractReplyMessage\u003e replyHandler)`     | Send a `AbstractMessage` value and handle a reply value _(ideally of an expected type)_, return when reply has been handled. |\n\nThe available request/response messages:\n\n| Request type                       | Response type                    | Description |\n|------------------------------------|----------------------------------|-------------|\n| `RequestClassMessage`              | `ReplyClassMessage`              | Get the `byte[]` of a class, wrapped as a `ClassData` type. |\n| `RequestClassloaderClassesMessage` | `ReplyClassloaderClassesMessage` | Get the names of classes belonging to a given `ClassLoader`. |\n| `RequestClassloadersMessage`       | `ReplyClassloadersMessage`       | Get the `int loaderId` values of all `ClassLoader` values. |\n| `RequestFieldGetMessage`           | `ReplyFieldGetMessage`           | Get the `String` representation of a `static` field's value. |\n| `RequestFieldSetMessage`           | `ReplyFieldSetMessage`           | Set the value of a `static` field's value. |\n| `RequestPingMessage`               | `ReplyPingMessage`               | Ping pong. |\n| `RequestPropertiesMessage`         | `ReplyPropertiesMessage`         | Get the `System.getProperties()` values. |\n| `RequestRedefineMessage`           | `ReplyRedefineMessage`           | Redefine a class. |\n| `RequestSetPropertyMessage`        | `ReplySetPropertyMessage`        | Set a value within the `System.getProperties()`. |\n| `RequestThreadsMessage`            | `ReplyThreadsMessage`            | Get thread information about all running threads. |\n\nThe available broadcast messages:\n\n| Type                          | Description |\n|-------------------------------|-------------|\n| `BroadcastClassloaderMessage` | Sent any time a new `ClassLoader` has been used. |\n| `BroadcastClassMessage`       | Sent any time a class definition has been updated. |","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcol-e%2Finstrumentationserver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcol-e%2Finstrumentationserver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcol-e%2Finstrumentationserver/lists"}