It sounds like the queue entries -- especially since they are serializable --- are value objects and you shouldn't give execution behavior to them and shouldn't create them with Guice. Serializing objects that have Guice providers in them does not work out well. Instead, create them using new and have them encapsulate the arguments necessary to create a real runnable command. Then in your Worker, dequeue one and use a Map<String,Provider<Command>> or a Map<String,CommandFactory> (or if there are are two different injection times, a Map<String,Provider<CommandFactory>>) using MapBinder http://code.google.com/p/google-guice/wiki/Multibindings
The Provider and possible the use of an Assisted injection should give you the inflection points you need without recourse to injecting the injector. (Usually that trick is reserved for meta-level extensions or integration with other frameworks or systems (such as Servlets or Quartz or Hadoop) that use classnames or class objects and newInstance(), and you need to write an adapter. And of course your own static void main().) Leigh. -- 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/-/U5jzR8TLHUEJ. 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.
