T
- the type of the object managed by this initializer class.E
- The exception type thrown by initialize()
.public abstract class AbstractConcurrentInitializer<T,E extends Exception> extends Object implements ConcurrentInitializer<T>
Modifier and Type | Class and Description |
---|---|
static class |
AbstractConcurrentInitializer.AbstractBuilder<I extends AbstractConcurrentInitializer<T,E>,T,B extends AbstractConcurrentInitializer.AbstractBuilder<I,T,B,E>,E extends Exception>
Builds a new instance for subclasses.
|
NUL
Constructor and Description |
---|
AbstractConcurrentInitializer()
Constructs a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Calls the closer with the manager object.
|
protected abstract E |
getTypedException(Exception e)
Gets an Exception with a type of E as defined by a concrete subclass of this class.
|
protected T |
initialize()
Creates and initializes the object managed by this
ConcurrentInitializer . |
protected abstract boolean |
isInitialized()
Returns true if initialization has been completed.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
get, nul
public AbstractConcurrentInitializer()
public void close() throws ConcurrentException
ConcurrentException
- Thrown by the closer.protected abstract E getTypedException(Exception e)
e
- The actual exception that was thrownprotected T initialize() throws E extends Exception
ConcurrentInitializer
. This method is called by FailableSupplier.get()
when the object is accessed for the first time. An implementation can focus on the
creation of the object. No synchronization is needed, as this is already handled by get()
.
Subclasses and clients that do not provide an initializer are expected to implement this method.
protected abstract boolean isInitialized()
Copyright © 2001–2023 The Apache Software Foundation. All rights reserved.