private void sendOpsResponse ( VoltTable [ ] results , JSONObject obj , byte payloadType ) throws Exception { long requestId = obj . getLong ( "requestId" ) ; long returnAddress = obj . getLong ( "returnAddress" ) ; // Send a response with no data since the stats is not supported or not yet available if ( results == null ) { ByteBuffer responseBuffer = ByteBuffer . allocate ( 8 ) ; responseBuffer . putLong ( requestId ) ; byte responseBytes [ ] = CompressionService . compressBytes ( responseBuffer . array ( ) ) ; BinaryPayloadMessage bpm = new BinaryPayloadMessage ( new byte [ ] { payloadType } , responseBytes ) ; m_mailbox . send ( returnAddress , bpm ) ; return ; } ByteBuffer [ ] bufs = new ByteBuffer [ results . length ] ; int statbytes = 0 ; for ( int i = 0 ; i < results . length ; i ++ ) { bufs [ i ] = results [ i ] . getBuffer ( ) ; bufs [ i ] . position ( 0 ) ; statbytes += bufs [ i ] . remaining ( ) ; } ByteBuffer responseBuffer = ByteBuffer . allocate ( 8 + // requestId 4 * results . length + // length prefix for each stats table + statbytes ) ; responseBuffer . putLong ( requestId ) ; for ( ByteBuffer buf : bufs ) { responseBuffer . putInt ( buf . remaining ( ) ) ; responseBuffer . put ( buf ) ; } byte responseBytes [ ] = CompressionService . compressBytes ( responseBuffer . array ( ) ) ; BinaryPayloadMessage bpm = new BinaryPayloadMessage ( new byte [ ] { payloadType } , responseBytes ) ; m_mailbox . send ( returnAddress , bpm ) ; }
Return the results of distributed work to the original requesting agent . Used by subclasses to respond after they ve done their local work .