Another thought is to use guice's AOP and write a method interceptor for
PersistenceService.   Or figure out a way to wrap the persistence service.

I think the real question though is why does it need to initialize RIGHT
after?  The answer to this question will likely lead you towards the answer
to "how".

On Jul 17, 2011 12:01 AM, "ale" <[email protected]> wrote:

Hello.

I need to run a piece of code immediately after it has run PersistFilter.

The only way is to write my own PersistFilter? Is this a good aproach ?

@Singleton
public final class PersistFilter implements Filter {
  private final UnitOfWork unitOfWork;
  private final PersistService persistService;

  @Inject
  public PersistFilter(UnitOfWork unitOfWork, PersistService persistService)
{
    this.unitOfWork = unitOfWork;
    this.persistService = persistService;
  }

  public void init(FilterConfig filterConfig) throws ServletException {
    persistService.start();

    service1.start();    // <--- SOMETHING LIKE THIS

    service2.start();
  }
...

 --
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/-/sXTRTVEwrcgJ.
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.

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
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.

Reply via email to