Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use java Attach API to avoid jvm restart and javaagent parameter #54

Open
eostermueller opened this issue Jun 20, 2016 · 3 comments
Open

Comments

@eostermueller
Copy link

Hello,

Was thinking that the com.sun.tools.attach api would make it easier for people to install/adopt this tool.

Curious if you have tried it and ran into issues or just haven't had the time?

Thanks,
--Erik Ostermueller

@sylvainlaurent
Copy link
Owner

hello,

I thought about it but did not try as it appeared to require more work...
But feel free to create a pull request!

@eostermueller
Copy link
Author

eostermueller commented Jan 25, 2017

Greetings,

I'm in the middle of trying to code support for this issue I created.
Loading the agent jar file without the javaagent parameter was pretty straight forward. I have this coded on my own local fork. But I've run into a problem I don't know how to deal with.

The code at link [1] below suggests that ByteBuddy leaps into action when a java.sql.Driver is instantiated. Unfortunately, the goal of my enhancement is to launch the agent minutes or even hours/days after the jdbc Driver has already been instantiated.

Perhaps my enhancement could iterate thru DriverManager.getDrivers() (see link [2]) and pass the instances on to ByteBuddy?
If that looks helpful, perhaps you could show me what that code would look like?

Thanks,
--Erik

[1] https://github.com/sylvainlaurent/JDBC-Performance-Logger/blob/master/jdbc-perf-logger-agent/src/main/java/ch/sla/jdbcperflogger/agent/Agent.java#L46

[2] https://docs.oracle.com/javase/8/docs/api/java/sql/DriverManager.html#getDrivers--

@sylvainlaurent
Copy link
Owner

I'm not at all a ByteBuddy expert. You should try to get some help with the ByteBuddy community.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants