I want to understand the following, suppose I have following block of code:
try{
// do something
asynchronousMethodCallThatWritesFileOutputStreamToSocket(fileOutputStream);
}catch (SomeException e){
//handle exception
}finally{
closeFileOutputStream(fileOutputStream);
}
My question is will the finally block close stream before asynchronous method finishes? Or will it somehow await? Please, any quotes from the books, if you know. Thank you very much.
N.B. This is pseudo-code, I know try-with-resources patterns.