Code example for LinkedBlockingQueue

Methods: put, size

0
            } 
        } 
 
        private void handleNetworkError(RegistrationData registrationData, IOException x) {
            try { 
                queue.put(registrationData);
                LOG.info("Last.fm registration for " + registrationData.title +
                        " encountered network error.  Will try again later. In queue: " + queue.size(), x);
            } catch (InterruptedException e) {
                LOG.error("Failed to reschedule Last.fm registration for " + registrationData.title, e);
            } 
            try { 
                sleep(15L * 60L * 1000L);  // Wait 15 minutes.
            } catch (InterruptedException e) {
                LOG.error("Failed to sleep after Last.fm registration failure for " + registrationData.title, e);
            } 
        } 
    } 
 
    private static class RegistrationData { 
        private String username;