java - Using Future<V> -
in documentation, shows example code future<v>
, in gae datastore orm's can see usages pattern, implication of using future on doing datastore put
, get
or delete
methods? common motivation on doing this?
the reason future used because database operations done asynchronously, can carry on doing whatever , come check result of database operation.
the implications of asynchronous store read value stale, ie put has been sent future operation not complete, or worse, value has been deleted, orm has solved you.
you can use future.get block current thread , wait operation complete , check result.
Comments
Post a Comment