1 | package com.reallifedeveloper.common.application.notification; | |
2 | ||
3 | import java.io.IOException; | |
4 | ||
5 | import org.slf4j.Logger; | |
6 | import org.slf4j.LoggerFactory; | |
7 | ||
8 | import com.reallifedeveloper.common.domain.ErrorHandling; | |
9 | ||
10 | /** | |
11 | * A {@code java.lang.Runnable} that calls {@link NotificationService#publishNotifications(String)}. It can be used for scheduling regular | |
12 | * publication using a timer service. | |
13 | * | |
14 | * @author RealLifeDeveloper | |
15 | */ | |
16 | public final class NotificationPublisherTask implements Runnable { | |
17 | ||
18 | private static final Logger LOG = LoggerFactory.getLogger(NotificationPublisherTask.class); | |
19 | ||
20 | private final String publicationChannel; | |
21 | ||
22 | private final NotificationService notificationService; | |
23 | ||
24 | /** | |
25 | * Creates a new {@code NotificationPublishingTimerTask} that publishes to the given publication channel using the given | |
26 | * {@link NotificationService}. | |
27 | * | |
28 | * @param publicationChannel the name of the channel to which to publish | |
29 | * @param notificationService the {@code NotificationService} to use to do the actual publishing | |
30 | */ | |
31 | public NotificationPublisherTask(String publicationChannel, NotificationService notificationService) { | |
32 |
1
1. <init> : removed call to com/reallifedeveloper/common/domain/ErrorHandling::checkNull → KILLED |
ErrorHandling.checkNull("Arguments must not be null: publicationChannel=%s, notificationService=%s", publicationChannel, |
33 | notificationService); | |
34 | this.publicationChannel = publicationChannel; | |
35 | this.notificationService = notificationService; | |
36 | } | |
37 | ||
38 | @Override | |
39 | public void run() { | |
40 | try { | |
41 |
1
1. run : removed call to com/reallifedeveloper/common/application/notification/NotificationService::publishNotifications → KILLED |
notificationService.publishNotifications(publicationChannel); |
42 | } catch (IOException e) { | |
43 | LOG.error("Unexpected problem publishing notifications", e); | |
44 | } | |
45 | } | |
46 | ||
47 | } | |
Mutations | ||
32 |
1.1 |
|
41 |
1.1 |