خرید بک لینک

Vote count: 0

I'd like to port libraries to Java 8. At the moment I have blocking http operations, and the caller needs to care about this problem.

When I port my library to java 8, I am thinking of changing the method signatures not to return just Response, but instead to return CompletableFuture<Response>. For this to be possible the constructor of my main library class would need to take a third argument: An Executor or ExecutorService, so they have control about pool sizes, shutdown() etc.

I have seen many tutorials which discuess how CompletableFuture<?> works, but none of them is dealing with the question whether a libary should return those objects or let the caller deal with async "problems".

Another disadvantage might be, that I need to wrap my exceptions in a CompletionException.

Please help me decide which strategy is best: blocking operations and let the user decide, or just return a CompletableFuture<>.

Thanks.

asked 24 secs ago

برچسب: what should a library have,how should a library look like,what should a library be,what should a library offer,what should a library contain,what should a library management system have,how should a library be organized,should become a library technician,should library be capitalized,should library books be capitalized, نویسنده: استخدام کار تاريخ: يکشنبه 7 شهريور 1395 ساعت: 18:25

صفحه بندی