尽管我不认为这是 Vaadin 特定的问题。我真正需要做的就是重新加入未来在完成时创建的线程。
(ClickHandler) (event) -> {
log().debug( "current Thread {}", Thread.currentThread().getId() );
viewModel.generateFileDownload().thenAccept( this::download );
// needs to continue to this immediately, note: there are similarly vaadin reasons why you can't just block here.
button.setEnabled( false );
}
private void download( final File file ) {
// do stuff that needs to happen in the original thread
log().debug( "current Thread {}", Thread.currentThread().getId() );
button.setEnabled( true );
}
我需要这些线程 ID 相同,显然我可以重做这个。我知道有一个加入,但现在确定当我在完成之前不想重新加入时这对我有什么帮助?