private void setTempoMaster ( DeviceUpdate newMaster ) { DeviceUpdate oldMaster = tempoMaster . getAndSet ( newMaster ) ; if ( ( newMaster == null && oldMaster != null ) || ( newMaster != null && ( ( oldMaster == null ) || ! newMaster . getAddress ( ) . equals ( oldMaster . getAddress ( ) ) ) ) ) { // This is a change in master, so report it to any registered listeners deliverMasterChangedAnnouncement ( newMaster ) ; } }
Establish a new tempo master and if it is a change from the existing one report it to the listeners .