mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-20 06:45:50 +00:00
fixed admin notification to async
This commit is contained in:
parent
dc99b95b10
commit
74724aa627
1 changed files with 15 additions and 1 deletions
|
@ -27,7 +27,7 @@ public class DomainValidationService {
|
|||
saveValidationResults(domain, false, false);
|
||||
}
|
||||
|
||||
notifyAdmin(domain);
|
||||
asyncNotifyAdmin(domain);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -84,6 +84,20 @@ public class DomainValidationService {
|
|||
System.out.println("Notifying admin: " + notification);
|
||||
}
|
||||
|
||||
private void asyncNotifyAdmin(String domain) {
|
||||
// Simulated notification: Creating a fake notification object and printing its
|
||||
// contents
|
||||
Notification notification = new Notification("admin@example.com", "Domain Validation Completed",
|
||||
"Validation completed for domain: " + domain);
|
||||
try {
|
||||
Thread.sleep(2000);
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
System.out.println("Notifying admin: " + notification);
|
||||
}
|
||||
|
||||
// Fake method to check if the domain is reserved
|
||||
private boolean isReservedDomain(String domain) {
|
||||
String[] reservedDomains = { "example.com", "localhost" };
|
||||
|
|
Loading…
Reference in a new issue