Giriş
Şunlar kullanılabilir.
submitToAllMembers //Tüm üyelere göndersubmitToKeyOwner //Belirtilen key sahibi üyeye göndersubmitToMember //Belirtilen üyeye göndersubmitToMembers //Belirtilen üyelere gönder
İmzalar şöyle
Future<T> submit(Callable<T> task, MemberSelector memberSelector); void submit(Callable<T> task,ExecutionCallback<T> callback); void submit(Callable<T> task, MemberSelector memberSelector, ExecutionCallback<T> callback); Future<T> submitToKeyOwner(Callable<T> task, Object key); void submitToKeyOwner(Callable<T> task, Object key, ExecutionCallback<T> callback); Future<T> submitToMember(Callable<T> task, Member member); void submitToMember(Callable<T> task, Member member, ExecutionCallback<T> callback); Map<Member, Future<T>> submitToMembers(Callable<T> task, Collection<Member> members); Map<Member, Future<T>> submitToMembers(Callable<T> task, MemberSelector memberSelector); void submitToMembers(Callable<T> task,Collection<Member> members, MultiExecutionCallback callback); void submitToMembers(Callable<T> task, MemberSelector memberSelector, MultiExecutionCallback callback); Map<Member, Future<T>> submitToAllMembers(Callable<T> task); void submitToAllMembers(Callable<T> task, MultiExecutionCallback callback);
submit metodu
Örnek
Şöyle yaparız
public class DemoTask implements Callable<Map<String, Object>>, Serializable { ... @Override public Map<String, Object> call() throws Exception { ... Map<String, Object> result = new HashMap<>(); result.put("...", "..." return result; } } DemoTask task = new DemoTask(); executorService.submit(task, new ExecutionCallback<Map<String, Object>>() { @Override public void onResponse(Map<String, Object> incomingResponse) { ... } @Override public void onFailure(Throwable t) { ... } });
Hiç yorum yok:
Yorum Gönder