public synchronized ListenableFuture < ? > add ( Page page ) { checkState ( ! isFull ( ) , "PageBuffer is full!" ) ; pages . offer ( page ) ; if ( isFull ( ) ) { if ( settableFuture == null ) { settableFuture = SettableFuture . create ( ) ; } return settableFuture ; } return NOT_FULL ; }
Adds a page to the buffer . Returns a ListenableFuture that is marked as done when the next page can be added .