public interface FutureAppendable
This allows to provide the content of the CharSequence to append at the very last moment, when all the CharSequences are effectively appended together.
While this interface allows concurrent implementation of an Appendable (based on Future), implementations are not
required to be Thread-safe. This means that enqueueAppend(Future)
, performAppends()
and
hasPending()
are supposed to be called for the same Thread.
Management of Threads concurrency must be implemented by the Future implementation which must perform all the synchronization work between any background Thread and the calling Thread.
Modifier and Type | Method and Description |
---|---|
FutureAppendable |
enqueueAppend(Future<CharSequence> csq)
Queue the Future<CharSequence> for append in this FutureAppendable.
|
boolean |
hasPending()
Check if some append operations are still waiting for
performAppends() to be called. |
FutureAppendable |
performAppends()
Wait for all computation to complete and perform the pending append operations.
|
FutureAppendable |
performAppends(int timeout,
TimeUnit unit)
Wait for all computation to complete and perform the pending append operations.
|
FutureAppendable enqueueAppend(Future<CharSequence> csq) throws IOException
Caller may start computing the content of the Future parameter before or after calling this method (using other Thread) or simply wait for Future#get() to be called (deferred computation).
csq
- The Future character sequence to append. If csq is null, then the four characters
"null" are appended to this FutureAppendable.IOException
- If an I/O error occursFutureAppendable performAppends() throws IOException, HttpErrorPage
IOException
HttpErrorPage
FutureAppendable performAppends(int timeout, TimeUnit unit) throws IOException, HttpErrorPage, TimeoutException
timeout
- unit
- IOException
HttpErrorPage
TimeoutException
boolean hasPending()
performAppends()
to be called.Copyright © 2008–2018. All rights reserved.