code: protected void flushAllSessions() {
          try {
              Field field = bugsnag.getClass().getDeclaredField("sessionTracker");
              field.setAccessible(true);
              Object sessionTracker = field.get(bugsnag);
  
              field = sessionTracker.getClass().getDeclaredField("enqueuedSessionCounts");
              field.setAccessible(true);
              Collection sessionCounts = (Collection) field.get(sessionTracker);
  
              // Flush the sessions
              Method method = sessionTracker.getClass().getDeclaredMethod("flushSessions", Date.class);
              method.setAccessible(true);
              Calendar calendar = Calendar.getInstance();
              calendar.add(Calendar.MINUTE, 2);
              method.invoke(sessionTracker, calendar.getTime());
  
              // Wait until sessions are flushed
              while (sessionCounts.size() > 0) {
                  Thread.sleep(1000);
              }
          } catch (java.lang.Exception ex) {
              LOGGER.error("failed to flush sessions", ex);
          }
      }
docs: Flushes sessions from the Bugsnag object