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

Defining IDeref can break AOT compiled clojure projects. #34

Open
aphyr opened this issue Feb 18, 2014 · 3 comments
Open

Defining IDeref can break AOT compiled clojure projects. #34

aphyr opened this issue Feb 18, 2014 · 3 comments

Comments

@aphyr
Copy link
Collaborator

aphyr commented Feb 18, 2014

No description provided.

@aphyr
Copy link
Collaborator Author

aphyr commented Feb 18, 2014

@andrusieczko
Copy link

Hi @aphyr,

Any plans to fix this?

I've got a project with elastic search and wanted to update it to 2.2.0 and got the jar hell error due to IBlockingDeref class you define here:

https://github.com/aphyr/riemann-java-client/blob/master/riemann-java-client/src/main/java/clojure/lang/IBlockingDeref.java

In the newest elastic, you can't disable their JarHell, so I can't move on without fixing this issue.

Thanks,
Karol

P.S. I actually moved both interfaces to com.aphyr.riemann.client and everything works just fine. Please look at the #69.

@aphyr aphyr mentioned this issue Feb 3, 2016
@andrusieczko
Copy link

Hey,

So I spent some time on looking at this issue.

So there are two (three?) approaches I found.

  1. Change map-promise method in client.clj:
    https://github.com/aphyr/riemann-clojure-client/compare/master...andrusieczko:map-promise-fix?expand=1

    So this works fine, all the tests are passing.

    Advantage: it's a small, simple change

    Downside: if someone wants to use RiemannClient instance directly, calling the java methods on it (like (.sendEvent ^IRiemannClient rc event)). Then result will be IPromise which won’t be subtype of clojure.lang.IDeref anymore.

  2. Change the RiemannClient constructor methods to use proxy in client.clj:
    https://github.com/aphyr/riemann-clojure-client/compare/master...andrusieczko:deref-fix?expand=1

    Still a couple of things to be done there (no point of finishing it now):

    • all the constructor methods would need to use proxies
    • not all nested method calls (that return IPromise) still don't work

    Advantage: it should work for all the cases and the user doesn't have to know anything about the implementation

    Disadvantage: it's very complicated

  3. Use Futures instead of Promises :)

Please let me know what you think about it and I can finish the implementation.

Regards,
Karol

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