public static String jsonifyClusterTrackers ( Pair < Long , Long > lastConsumerUniqueIds , Map < Integer , Map < Integer , DRSiteDrIdTracker > > allProducerTrackers ) throws JSONException { JSONStringer stringer = new JSONStringer ( ) ; stringer . object ( ) ; stringer . keySymbolValuePair ( "lastConsumerSpUniqueId" , lastConsumerUniqueIds . getFirst ( ) ) ; stringer . keySymbolValuePair ( "lastConsumerMpUniqueId" , lastConsumerUniqueIds . getSecond ( ) ) ; stringer . key ( "trackers" ) . object ( ) ; if ( allProducerTrackers != null ) { for ( Map . Entry < Integer , Map < Integer , DRSiteDrIdTracker > > clusterTrackers : allProducerTrackers . entrySet ( ) ) { stringer . key ( Integer . toString ( clusterTrackers . getKey ( ) ) ) . object ( ) ; for ( Map . Entry < Integer , DRSiteDrIdTracker > e : clusterTrackers . getValue ( ) . entrySet ( ) ) { stringer . key ( e . getKey ( ) . toString ( ) ) ; stringer . value ( e . getValue ( ) . toJSON ( ) ) ; } stringer . endObject ( ) ; } } stringer . endObject ( ) ; stringer . endObject ( ) ; return stringer . toString ( ) ; }
Serialize the cluster trackers into JSON .