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

Investigate how modules can use callback provided by their caller/environment #48

Open
quintesse opened this issue Oct 29, 2013 · 4 comments
Assignees
Milestone

Comments

@quintesse
Copy link
Member

We need to figure out how we can have code running inside a JBoss Modules environment use callbacks provided by their caller / environment.

Examples of two situations where we need this right now are:

  • Download progress reporting by the CMR. For a command line tool we could just let the CMR spit out the information to the logger, but for integration in Eclipse we would need something else.
  • Unit Tests in Eclipse. The test framework being run needs to be able to communicate what tests it found and what ti is doing right now and what the results of the tests are.

Assigning this to @alesj for now so he reads this and can leave feedback. (I've talked to him on IRC, but I think it's important to leave any information he can give documented here)

@ghost ghost assigned alesj Oct 29, 2013
@alesj
Copy link
Member

alesj commented Oct 29, 2013

I don't see how this could work if it's not the env that starts the whole thing that sets-up / instantiates the callbacks.
Or that all callbacks "communicate" with starting env via static variables or ThreadLocals.

But I'll think about this a bit more, and try to hack some poc.

How soon do you need this?
(not that I have too much time ...)

@quintesse
Copy link
Member Author

No no, the env setting up everything is good, the idea is exactly that I'd have something like:

    interface Progress {
        void notify(String blah, int whatever);
    }

    Progress progressListener = createProgressListener();

     // And HERE something to pass --^ to --v

    org.jboss.modules.Module.setModuleLogger(new JDKModuleLogger());
    org.jboss.modules.Main.main(setupArguments(argList, sysRep, ceylonVersion));
    ModuleLoader ml = Module.getBootModuleLoader();
    runtimeModule = ml.loadModule(ModuleIdentifier.create(CEYLON_RUNTIME, ceylonVersion));

while the code being run by JB Modules would be something like:

    Progress progress = getProgressListenerSomehow();

    do {
        // Work
        progress.notify("foo", x);
    } while(...);

And you needn't spend too much on it, I'm willing to try it myself if you say for example that using ThreadLocal for this is perfectly acceptable. But with all the special class loading that JB Modules does I was expecting not to have access to the (same) Progress interface or whatever. But maybe I'm just too paranoid anf things are much easier than I make them out to be?

@FroMage
Copy link
Member

FroMage commented Nov 7, 2013

Moved to 1.1

@FroMage
Copy link
Member

FroMage commented Sep 25, 2014

Moving to 1.2, unfortunately.

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

No branches or pull requests

3 participants