Created
December 30, 2014 21:02
-
-
Save maxant/f527374c8e6fbcf57d26 to your computer and use it in GitHub Desktop.
Handling the end of persistence
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
persistSales(sales, t -> { | |
if(t != null){ | |
LOGGER.error("failed to persist sales: " + sales, t); | |
}else{ | |
LOGGER.info("persisting completed, notifying involved parties..."); | |
sales.stream().forEach(sale -> { | |
if (sale.getBuyer().listener != null) | |
sale.getBuyer().listener.onEvent(EventType.PURCHASE, sale); | |
if (sale.getSeller().listener != null) | |
sale.getSeller().listener.onEvent(EventType.SALE, sale); | |
}); | |
... | |
} | |
listener.onEvent(EventType.STOPPED, null); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment