sdk/src/main/java/com/bugsnag/android/SessionTracker.java
void flushStoredSessions() {
        if (flushingRequest.tryAcquire(1)) {
            try {
                List<File> storedFiles;

                storedFiles = sessionStore.findStoredFiles();

                if (!storedFiles.isEmpty()) {
                    SessionTrackingPayload payload =
                        new SessionTrackingPayload(null, storedFiles,
                            client.appData, client.deviceData);

                    //FUTURE:SM Reduce duplication here and above
                    try {
                        configuration.getDelivery().deliver(payload, configuration);
                        sessionStore.deleteStoredFiles(storedFiles);
                    } catch (DeliveryFailureException exception) {
                        sessionStore.cancelQueuedFiles(storedFiles);
                        Logger.warn("Leaving session payload for future delivery", exception);
                    } catch (Exception exception) {
                        // drop bad data
                        Logger.warn("Deleting invalid session tracking payload", exception);
                        sessionStore.deleteStoredFiles(storedFiles);
                    }
                }
            } finally {
                flushingRequest.release(1);
            }
        }
    }
/**
     * Attempts to flush session payloads stored on disk
     */
Attempts to flush session payloads stored on disk
Attempts to flush session payloads stored on disk
void flushStoredSessions() {
        if (flushingRequest.tryAcquire(1)) {
            try {
                List<File> storedFiles;
                storedFiles = sessionStore.findStoredFiles();
                if (!storedFiles.isEmpty()) {
                    SessionTrackingPayload payload =
                        new SessionTrackingPayload(null, storedFiles,
                            client.appData, client.deviceData);
                    try {
                        configuration.getDelivery().deliver(payload, configuration);
                        sessionStore.deleteStoredFiles(storedFiles);
                    } catch (DeliveryFailureException exception) {
                        sessionStore.cancelQueuedFiles(storedFiles);
                        Logger.warn("Leaving session payload for future delivery", exception);
                    } catch (Exception exception) {
                        Logger.warn("Deleting invalid session tracking payload", exception);
                        sessionStore.deleteStoredFiles(storedFiles);
                    }
                }
            } finally {
                flushingRequest.release(1);
            }
        }
    }
void flushStoredSessions ( ) { if ( flushingRequest . tryAcquire ( 1 ) ) { try { List < File > storedFiles ; storedFiles = sessionStore . findStoredFiles ( ) ; if ( ! storedFiles . isEmpty ( ) ) { SessionTrackingPayload payload = new SessionTrackingPayload ( null , storedFiles , client . appData , client . deviceData ) ; try { configuration . getDelivery ( ) . deliver ( payload , configuration ) ; sessionStore . deleteStoredFiles ( storedFiles ) ; } catch ( DeliveryFailureException exception ) { sessionStore . cancelQueuedFiles ( storedFiles ) ; Logger . warn ( "Leaving session payload for future delivery" , exception ) ; } catch ( Exception exception ) { Logger . warn ( "Deleting invalid session tracking payload" , exception ) ; sessionStore . deleteStoredFiles ( storedFiles ) ; } } } finally { flushingRequest . release ( 1 ) ; } } }
Attempts to flush session payloads stored on disk
Attempts to flush session payloads stored on disk
//FUTURE:SM Reduce duplication here and above // drop bad data