@ Override public void sendData ( TreeSet < Data > data ) { if ( data == null ) { throw new IllegalArgumentException ( "Data must be not null" ) ; } if ( data . isEmpty ( ) ) { return ; } addData ( data ) ; if ( distributed ) { partitionManager . notifyData ( new ArrayList <> ( data ) ) ; } }
use synchronized blocks to protect pendingData .