private void waitForSent ( ) { debug ( "GuestNode#waitForSent(): Waiting for other clusters sent" ) ; while ( true ) { boolean othersSent = true ; Map < String , Long > clusterNameToReceivedAtMap = new HashMap < String , Long > ( ) ; for ( Object key : clustersProperties . keySet ( ) ) { String clusterName = ( String ) key ; if ( localClusterName . equals ( clusterName ) ) { continue ; } Long sentAt = region . get ( createSentAtKey ( clusterName ) ) ; long receivedAt = System . currentTimeMillis ( ) ; if ( ( sentAt != null ) && ( sentAt . longValue ( ) > processingStartedAt ) ) { clusterNameToReceivedAtMap . put ( clusterName , receivedAt ) ; } } for ( Object key : clustersProperties . keySet ( ) ) { String clusterName = ( String ) key ; if ( localClusterName . equals ( clusterName ) ) { continue ; } Long receivedAt = clusterNameToReceivedAtMap . get ( clusterName ) ; if ( receivedAt == null ) { if ( othersSent ) { othersSent = false ; } } else { region . put ( createReceivedAtKey ( clusterName , localClusterName ) , receivedAt ) ; } } if ( othersSent ) { break ; } try { TimeUnit . MILLISECONDS . sleep ( CHECK_PERIOD ) ; } catch ( InterruptedException e ) { } } debug ( "GuestNode#waitForSent(): Other clusters sent" ) ; }
Wait until received all the entries from other clients . Put the receivedAt entries to cache .