Code example for TimeUnit

Methods: toSeconds

0
 * Servlet, called from an App Engine task, that sends the given message (sync or announcement) 
 * to all devices in a given multicast group (up to 1000). 
 */ 
public class SendMessageServlet extends BaseServlet { 
 
    private static final int ANNOUNCEMENT_TTL = (int) TimeUnit.MINUTES.toSeconds(300);
 
    private Sender sender;
 
    @Override 
    public void init(ServletConfig config) throws ServletException {
        super.init(config);
        sender = newSender(config);
    } 
 
    /** 
     * Creates the {@link Sender} based on the servlet settings. 
     */ 
    protected Sender newSender(ServletConfig config) {
        String key = (String) config.getServletContext()
                .getAttribute(ApiKeyInitializer.ATTRIBUTE_ACCESS_KEY);