mdedetrich commented on PR #2486:
URL: https://github.com/apache/pekko/pull/2486#issuecomment-3522918930

   So regarding blocking on `close()`, the official documentation from 
https://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html
 i.e.
   
   > See the Javadoc of the 
[AutoCloseable](https://docs.oracle.com/javase/8/docs/api/java/lang/AutoCloseable.html)
 and 
[Closeable](https://docs.oracle.com/javase/8/docs/api/java/io/Closeable.html) 
interfaces for a list of classes that implement either of these interfaces. The 
Closeable interface extends the AutoCloseable interface. The close method of 
the Closeable interface throws exceptions of type IOException while the close 
method of the AutoCloseable interface throws exceptions of type Exception. 
Consequently, subclasses of the AutoCloseable interface can override this 
behavior of the close method to throw specialized exceptions, such as 
IOException, or no exception at all.
   
   And more directly from 
https://docs.oracle.com/javase/8/docs/api/java/lang/AutoCloseable.html
   
   > While this interface method is declared to throw Exception, implementers 
are strongly encouraged to declare concrete implementations of the close method 
to throw more specific exceptions, or to throw no exception at all if the close 
operation cannot fail.
   
   > Cases where the close operation may fail require careful attention by 
implementers. It is strongly advised to relinquish the underlying resources and 
to internally mark the resource as closed, prior to throwing the exception. The 
close method is unlikely to be invoked more than once and so this ensures that 
the resources are released in a timely manner. Furthermore it reduces problems 
that could arise when the resource wraps, or is wrapped, by another resource.
   
   Implies that it is expected that if the `close()` method fails that an 
exception should be thrown. It is possible for `ActorSystem.terminate()` to 
fail and the only way to throw an exception in this case is to block on it.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to