public static TimerPushService get(final Application application) { TimerPushService service = INSTANCES.get(application); if (service == null) { service = new TimerPushService(); final TimerPushService existingInstance = INSTANCES.putIfAbsent(application, service); if (existingInstance == null) /* * If this is the first instance of this service for the given application, then * schedule the cleanup task. */ service.setCleanupInterval(Duration.seconds(60)); else // If it is not the first instance, throw it away. service = existingInstance; } return service; }
public static TimerPushService get(final Application application) { Args.notNull(application, "application"); TimerPushService service = INSTANCES.get(application); if (service == null) { service = new TimerPushService(); final TimerPushService existingInstance = INSTANCES.putIfAbsent(application, service); if (existingInstance == null) /* * If this is the first instance of this service for the given application, then * schedule the cleanup task. */ service.setCleanupInterval(Duration.seconds(60)); else // If it is not the first instance, throw it away. service = existingInstance; } return service; }