public abstract class AbstractBlockingExtension extends Object implements Extension
abstract
Extension
whose implementations can
legally and politely prevent a CDI container from exiting.
The most common use case for such an implementation is an Extension
that wishes to launch a server of some kind and to
notionally block until someone interrupts the process.
CountDownLatch
,
CountDownLatch.countDown()
,
CountDownLatch.await()
Modifier and Type | Field and Description |
---|---|
protected Logger |
logger
The
Logger used by instances of this class. |
Modifier | Constructor and Description |
---|---|
protected |
AbstractBlockingExtension()
Creates a new
AbstractBlockingExtension by calling the
appropriate constructor with a new CountDownLatch with
an initial count of 1 . |
protected |
AbstractBlockingExtension(CountDownLatch latch)
Creates a new
AbstractBlockingExtension that uses the
supplied CountDownLatch for governing blocking behavior,
and installs a shutdown hook that (indirectly) calls countDown() on the supplied latch . |
Modifier and Type | Method and Description |
---|---|
protected Logger |
createLogger()
Returns a
Logger suitable for use with this AbstractBlockingExtension implementation. |
void |
unblock()
|
static void |
unblockAll()
Unblocks all known instances of the
AbstractBlockingExtension class by calling their associated
CountDownLatch es supplied at their
construction time. |
protected final Logger logger
Logger
used by instances of this class.
This field is never null
.
createLogger()
protected AbstractBlockingExtension()
AbstractBlockingExtension
by calling the
appropriate constructor with a new CountDownLatch
with
an initial count of 1
.protected AbstractBlockingExtension(CountDownLatch latch)
AbstractBlockingExtension
that uses the
supplied CountDownLatch
for governing blocking behavior,
and installs a shutdown hook that (indirectly) calls countDown()
on the supplied latch
.latch
- a CountDownLatch
whose CountDownLatch.countDown()
and CountDownLatch.await()
methods will be used to control blocking behavior; may be null
in which case no blocking behavior will take placeprotected Logger createLogger()
Logger
suitable for use with this AbstractBlockingExtension
implementation.
This method never returns null
.
Overrides of this method must not return null
.
null
Logger
public void unblock()
CountDownLatch.countDown()
on the CountDownLatch
supplied at
construction time.
This method may be invoked more than once without any side effects.
unblockAll()
public static final void unblockAll()
AbstractBlockingExtension
class by calling their associated
CountDownLatch
es supplied at their
construction time.
This method may be invoked more than once without any side effects.
unblock()
Copyright © 2017–2018, microBean. All rights reserved.