Exception Passing Through scala.concurrent.Future? -


is possible exception thrown, escaping future context?

since future "evaluates" it's defined:

is possible definition of future throw exception, passing through future context?

scala> future { thread.sleep(3000); println("3 seconds elapsed"); 100 } res2: scala.concurrent.future[int] =       scala.concurrent.impl.promise$defaultpromise@56113384  scala> 3 seconds elapsed 

i not come such example.

scala> future { throw new exception("foo!") } res3: scala.concurrent.future[nothing] =    scala.concurrent.impl.promise$defaultpromise@47a86fbb 

yes, maybe not quite way you're thinking of. according source, errors not nonfatal escape future.apply.

 try success(body) catch { case nonfatal(e) => failure(e) } 

i.e. exceptions like: virtualmachineerror, outofmemoryerror,stackoverflowerror, threaddeath, linkageerror, interruptedexception, controlthrowable.. go uncaught represent fatal jvm error not able handle.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -