Hi all,
I am configuring the GUI by instantiating the injector in the "invokeLater"
method, to make sure all Swing components get instantiated in the EDT.
The issue is I must define some SwingWorkers which need injection of both a
Swing component and a background thread object (singleton) , to be used in
the doInBackground() method.
Since singletons are instantiated eagerly (at least in production stage),
the solution I figured out was to use a different injector to instantiate
such a singleton, which is called in the main method, to make sure the
singleton actually get instantiated in a thread which is not EDT.
I'd like to have a constructor such as:
@Inject MySwingWorker(JPanel panel, MyBackgroundThreadInterface
massiveTaskPerformer) {...}
But this won't work, as MySwingWorker and JPanel are created by the Swing
injector and the second parameter is provided by a different injector...
To wrap up, I am pretty sure I am overcomplicating the problem... without
actually solving it :) Do you know a good way to solve this?
--
You received this message because you are subscribed to the Google Groups
"google-guice" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-guice/-/FugvvbIu4cEJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-guice?hl=en.