private void addSaveRequest(SaveRequest r) { synchronized (this) { // some time onDestroy() execute before add save request which is // through // post runnable synchronized (mSaveServiceObject) { if (mSaverService == null) { Log.e(TAG, "[addSaveRequest]mSaverService is null,return."); return; } while (mSaverService.getWaitingCount() >= QUEUE_LIMIT) { try { Log.i(TAG, "[addSaveRequest],waiting count > QUEUE_LIMIT 100,wait..."); wait(); } catch (InterruptedException ex) { // ignore. Log.e(TAG, "[addSaveRequest]exception:", ex); } } Log.i(TAG, "[addSaveRequest]mSaverService.addSaveRequest..."); mSaverService.addSaveRequest(r); } } }
public int getWaitingCount() { Log.d(TAG, "[getWaitingCount]..."); if (mSaverService == null) { Log.e(TAG, "[getWaitingCount]mSaverService is null,return!"); return -1; } return mSaverService.getWaitingCount(); }
public void waitDone() { Log.i(TAG, "[waitDone]..."); if (mSaverService == null) { Log.e(TAG, "[waitDone]mSaverService is null,return."); return; } synchronized (FileSaver.this) { while (mSaverService != null && !mSaverService.isNoneSaveTask()) { try { wait(); } catch (InterruptedException ex) { Log.e(TAG, "[waitDone]exception :", ex); } } } Log.i(TAG, "[waitDone]"); }
public long getWaitingDataSize() { Log.d(TAG, "[getWaitingDataSize]..."); return mSaverService.getWaitingDataSize(); }