Java Code Examples for de.codecentric.boot.admin.server.domain.events.InstanceEvent#getVersion()

The following examples show how to use de.codecentric.boot.admin.server.domain.events.InstanceEvent#getVersion() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HazelcastNotificationTrigger.java    From spring-boot-admin with Apache License 2.0 6 votes vote down vote up
@Override
protected Mono<Void> sendNotifications(InstanceEvent event) {
	while (true) {
		Long lastSentEvent = this.sentNotifications.getOrDefault(event.getInstance(), -1L);
		if (lastSentEvent >= event.getVersion()) {
			log.debug("Notifications already sent. Not triggering notifiers for {}", event);
			return Mono.empty();
		}

		if (lastSentEvent < 0) {
			if (this.sentNotifications.putIfAbsent(event.getInstance(), event.getVersion()) == null) {
				log.debug("Triggering notifiers for {}", event);
				return super.sendNotifications(event);
			}
		}
		else {
			if (this.sentNotifications.replace(event.getInstance(), lastSentEvent, event.getVersion())) {
				log.debug("Triggering notifiers for {}", event);
				return super.sendNotifications(event);
			}
		}
	}
}
 
Example 2
Source File: ConcurrentMapEventStore.java    From Moss with Apache License 2.0 4 votes vote down vote up
private OptimisticLockingException createOptimisticLockException(InstanceEvent event, long lastVersion) {
    return new OptimisticLockingException(
        "Verison " + event.getVersion() + " was overtaken by " + lastVersion + " for " + event.getInstance());
}
 
Example 3
Source File: ConcurrentMapEventStore.java    From spring-boot-admin with Apache License 2.0 4 votes vote down vote up
private OptimisticLockingException createOptimisticLockException(InstanceEvent event, long lastVersion) {
	return new OptimisticLockingException(
			"Version " + event.getVersion() + " was overtaken by " + lastVersion + " for " + event.getInstance());
}