| 1 | package edu.ucsb.cs156.diningcachingproxy.services; | |
| 2 | ||
| 3 | import edu.ucsb.cs156.diningcachingproxy.jobs.ResolveHostnameJob; | |
| 4 | import edu.ucsb.cs156.jobs.entities.Job; | |
| 5 | import edu.ucsb.cs156.jobs.services.JobService; | |
| 6 | import org.springframework.beans.factory.annotation.Autowired; | |
| 7 | import org.springframework.stereotype.Service; | |
| 8 | ||
| 9 | /** | |
| 10 | * Builds and launches a {@link ResolveHostnameJob} for one IP address. Used both to auto-trigger | |
| 11 | * resolution the first time an address is seen, and to manually retry it on demand - a single call | |
| 12 | * site for both so there's exactly one place that knows how to build this job. | |
| 13 | */ | |
| 14 | @Service | |
| 15 | public class ResolveHostnameJobFactory { | |
| 16 | ||
| 17 | @Autowired private HostTrackingService hostTrackingService; | |
| 18 | @Autowired private JobService jobService; | |
| 19 | ||
| 20 | public Job launch(String ipAddress) { | |
| 21 | ResolveHostnameJob job = | |
| 22 | ResolveHostnameJob.builder() | |
| 23 | .ipAddress(ipAddress) | |
| 24 | .hostTrackingService(hostTrackingService) | |
| 25 | .build(); | |
| 26 |
1
1. launch : replaced return value with null for edu/ucsb/cs156/diningcachingproxy/services/ResolveHostnameJobFactory::launch → KILLED |
return jobService.runAsJob(job); |
| 27 | } | |
| 28 | } | |
Mutations | ||
| 26 |
1.1 |