java - Lifecycle of JobQueue with respect to callback method -


i using com.birbit:android-priority-jobqueue:1.3.5 send data server. here how.

@override public void onrun() throws throwable {   mystuff mystuff = getmystufffromcontentprovider(mdbid);   sendafterphotoscallback callback = new sendafterphotoscallback() {…}   callback.xdone=false;   callback.ydone=false;   callback.zdone=false;   sendphotosxtoamazons3usingtransferutility(mystuff,callback);   sendphotosytoamazons3usingtransferutility(mystuff,callback);   sendphotosztoamazons3usingtransferutility(mystuff,callback);   //callback.sendjson(mystuff); } 

what’s big deal? sendjson must called after other 3 methods done work. transferutility sends data s3 asynchronously. track each of these -toamazons3usingtransferutility successful using atomicinteger count completion of each transferobserver.

public static abstract class sendafterphotoscallback{         static boolean xdone = false;         static boolean ydone = false;         static boolean zdone = false;         abstract public void sendjson(mystuff mystuff)  throws throwable;     } 

when each -toamazons3usingtransferutility done, sets respective flag true (i.e. callback.xdone=true) , calls callback.sendjson(mystuff). inside sendjson check if flags set send json server.

anyway, since each -toamazons3usingtransferutility call callback.sendjson(mystuff) asynchronously, happens if callback.sendjson(mystuff) throws exception? onrun() of job queue see it?

this important because when onrun throws exception jobqueue knows retry later.

to best of knowledge onrun done running when async calls made. how fix problem code works well? there way transferutility work synchronously perhaps?


Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -