[wildfly-dev] a way to obtain local ModelController within javaagent?
John Mazzitelli
mazz at redhat.com
Sat Mar 11 01:43:54 EST 2017
OK, here's another one where I need some secret magical sauce - hoping someone knows of a technique I can use.
Suppose I have a javaagent installed in a WildFly server (using the standard -javaagent VM argument).
The javaagent would like to talk to the WildFly Server it is co-located with. Since it is in the same VM, the javaagent wants to avoid it looking like a remote call.
But I know of no way to obtain a local ModelController instance to build a client short of injecting some service or subsystem into WildFly itself (something I would like to avoid).
If the javaagent were instead a subsystem extension, it could do something like this:
InjectedValue<ModelController> mcValue = new InjectedValue<>();
...
((ServiceBuilder) bldr).addDependency(Services.JBOSS_SERVER_CONTROLLER, ModelController.class, mcValue);
...
WHAT_I_WANT = mcValue.getValue().createClient(...)
But obviously, that's no good for something running outside of the WildFly container (albeit in the same JVM).
Any hope at all? I was thinking some trickery on the order of what ByteMan does in order to figure out a way to obtain a local ModelController? But that's a last ditch effort :) Hoping there is something that uses a little less witchcraft.
More information about the wildfly-dev
mailing list