Git Product home page Git Product logo

Comments (5)

jbachorik avatar jbachorik commented on June 29, 2024

Unfortunately, this is a complex problem :(
For anything like 'computeIfAbsent' we would need to have support for lambdas and that is not trivial (probably doable, but requiring carefully designing the APIs and then implementation, of course).

If you need the synchronization now you can do @BTrace(trusted = true) to turn the safety verification off and then it is up to you to make sure you are not going to deadlock the traced app.

from btrace.

jbachorik avatar jbachorik commented on June 29, 2024

Unfortunately, this is a complex problem :(
For anything like 'computeIfAbsent' we would need to have support for lambdas and that is not trivial (probably doable, but requiring carefully designing the APIs and then implementation, of course).

Having said that, I have been pondering nicer APIs with Java 8 features for some time (eg. we could do iterations on collections as they would be guaranteed to be bounded etc.)

from btrace.

magicwerk avatar magicwerk commented on June 29, 2024

First of all, thanks for you always answering so promptly!

If I interpret your answer correctly, it seems that no synchronization happens at all between methods like onnewObject.
This would mean that access from several threads could not only produce false results in my example, but also crash the traced applications if unsafe MT access wrangles up some internal data structures.

So the HistoOnEvent example would be correct as the used Swing class is intended to use in a single threaded way, but is unsafe for general use. Therefore I think it would be good to add this information to the javadoc.

Then probably a more general example with @btrace(trusted=true) should be added showing MT-safety can be achieved in a general way.

I was also looking for general documentation about the MT behavior of the traced code, but this seems to be missing.
Also the mentioned annotation parameters of @btrace are not documented in the Wiki.

I was also looking for the source code in the btrace-client-2.2.-sources.jar, but the JAR does not contain the sources.
As this JARs is downloaded by Maven to provide sources, it would be good if they would be contained.

from btrace.

jbachorik avatar jbachorik commented on June 29, 2024

First of all, thanks for you always answering so promptly!

Not at all. It is refreshing to have engaging users :)

If I interpret your answer correctly, it seems that no synchronization happens at all between methods like onnewObject.
This would mean that access from several threads could not only produce false results in my example, but also crash the traced applications if unsafe MT access wrangles up some internal data structures.

Unfortunately, this is true.

So the HistoOnEvent example would be correct as the used Swing class is intended to use in a single threaded way, but is unsafe for general use. Therefore I think it would be good to add this information to the javadoc.

Yes, I will try to get some time this week to fix this. Or you can do a PR for this if you feel like it.

Then probably a more general example with @btrace(trusted=true) should be added showing MT-safety can be achieved in a general way.

The same as for the previous point.

I was also looking for general documentation about the MT behavior of the traced code, but this seems to be missing.
Also the mentioned annotation parameters of @btrace are not documented in the Wiki.

Yes, the documenatation is rather sparse :(

I was also looking for the source code in the btrace-client-2.2.-sources.jar, but the JAR does not contain the sources.
As this JARs is downloaded by Maven to provide sources, it would be good if they would be contained.

I will verify this. I was relying on the gradle tasks doing their job but there might be some problem in config.

from btrace.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.