android - Can we use single FutureTask with Executor with different purposes -
i used newsinglethreadexecutor executors
executor msessionexecutor = executors.newsinglethreadexecutor(); here future task returns list
futuretask<list<string>> listfuturetask = new futuretask<list<string>>(new callable<list<session>>() { @override public list<string> call() throws exception { return getsessions(); } }); for getting o/p using below code
msessionexecutor.execute(listfuturetask); list<string> sessions= listfuturetask.get(); so question can use same future task multiple time listfuturetask.get(); returns same value exist while running first task
so can use ?
msessionexecutor.execute(listfuturetask); msessionexecutor.execute(listfuturetask); .. multiple times after calling listfuturetask.get(); updated list always
Comments
Post a Comment