Java Agent that allows gaining access to JavaClasses' public methods via JSON-RPC 2.0 protocol on the specified socket.
Simply insert
-javaagent:path/to/jexposer.jar=class.you.want.to.be.Accessed@<port>
before the –jar
parameter of your java
command, then start sending requests via the specified socket port. Every instance of the class is treated as a distinct JSON-RPC server. Note that the agent does not interfere with *.class
files on the disk.
As pointed out in JSON-RPC 2.0 specification, using method names prefixed by rpc
is highly discouraged. If the method
field of a sent request is one of the following and the method is listed in the target class, the response will not be sent and the corresponding operation will be performed.
rpcShutdown
-- shuts down the server and the server's threadrpcSwitchSync
-- switches method invocation to synchronous mode (default), meaning that the server will not start parsing a new message before it responds to the ongoing request.rpcSwitchAsync
-- switches method invocation to asynchronous mode, meaning that the invocations could be executed in parallel (default parallelism is 4).
Certain properties could be specified
-Djexposer.parallelism
is the number ofForkJoinPool
parallelism to process the async invocations. The default number is4
.-Djexposer.thread.daemon
specifies whether the agent dies with an application or not. The default value istrue
.-Djexposer.thread.name
agent's thread name. The resulting name will beJSON-RPC@<specified name>
. The default name is the fully qualified class name.-Djexposer.thread.priority
defines the agent's thread priority. The default value is5
.