Example usage for org.springframework.integration.leader.event DefaultLeaderEventPublisher DefaultLeaderEventPublisher

List of usage examples for org.springframework.integration.leader.event DefaultLeaderEventPublisher DefaultLeaderEventPublisher

Introduction

In this page you can find the example usage for org.springframework.integration.leader.event DefaultLeaderEventPublisher DefaultLeaderEventPublisher.

Prototype

public DefaultLeaderEventPublisher(ApplicationEventPublisher applicationEventPublisher) 

Source Link

Document

Instantiates a new leader event publisher.

Usage

From source file:org.springframework.integration.etcd.leader.LeaderInitiator.java

@Override
public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {
    if (!this.customPublisher) {
        this.leaderEventPublisher = new DefaultLeaderEventPublisher(applicationEventPublisher);
    }//from w  w  w .  j  ava2  s.  c  om
}

From source file:org.springframework.integration.support.leader.LockRegistryLeaderInitiator.java

/**
 * Start the registration of the {@link #candidate} for leader election.
 *///from   w w  w.j  a  va 2  s .c o  m
@Override
public void start() {
    if (this.leaderEventPublisher == null && this.applicationEventPublisher != null) {
        this.leaderEventPublisher = new DefaultLeaderEventPublisher(this.applicationEventPublisher);
    }
    synchronized (this.lifecycleMonitor) {
        if (!this.running) {
            this.leaderSelector = new LeaderSelector(buildLeaderPath());
            this.future = this.executorService.submit(this.leaderSelector);
            this.running = true;
            logger.debug("Started LeaderInitiator");
        }
    }
}