org.glassfish.hk2
Interface AsyncPostConstruct

All Superinterfaces:
PostConstruct

public interface AsyncPostConstruct
extends PostConstruct

Some service's PostConstruct may optionally spawn internal initializations on separate threads.

In such situations, the service might block when methods are called on it until which time the service is fully initialized based on it's async-based initialization / operations.

This is an extension to PostConstruct that should be used in such situations.

Author:
Jeff Trent

Method Summary
 boolean isDone()
          Returns true if the service is fully ready to have methods called on it.
 void waitForDone()
          The implementation should block until the service is fully ready / initialized.
 boolean waitForDone(long timeout, TimeUnit unit)
          The implementation should return true immediately if the service is fully ready / initialized.
 
Methods inherited from interface org.glassfish.hk2.PostConstruct
postConstruct
 

Method Detail

isDone

boolean isDone()
Returns true if the service is fully ready to have methods called on it. Note that Implementors should not block for this operation. Implementors are, however, responsible for blocking if a call is made into the service before the requisite internal initialization are complete.


waitForDone

void waitForDone()
                 throws ExecutionException,
                        TimeoutException,
                        InterruptedException
The implementation should block until the service is fully ready / initialized.

Throws:
ExecutionException
TimeoutException
InterruptedException

waitForDone

boolean waitForDone(long timeout,
                    TimeUnit unit)
                    throws ExecutionException,
                           InterruptedException
The implementation should return true immediately if the service is fully ready / initialized. If not, the implementation should block for the duration of the timeout period before returning it's result.

The implementation should catch TimeoutException and return false instead of throwing.

Throws:
ExecutionException
InterruptedException


Copyright © 2012 Oracle Corporation. All Rights Reserved.