void send ( final long destinations [ ] , final VoltMessage message ) { if ( ! m_isUp ) { hostLog . warn ( "Failed to send VoltMessage because connection to host " + CoreUtils . getHostIdFromHSId ( destinations [ 0 ] ) + " is closed" ) ; return ; } if ( destinations . length == 0 ) { return ; } // if this link is "gone silent" for partition tests, just drop the message on the floor if ( ! m_linkCutForTest . get ( ) ) { m_network . enqueue ( new DeferredSerialization ( ) { @ Override public final void serialize ( final ByteBuffer buf ) throws IOException { buf . putInt ( buf . capacity ( ) - 4 ) ; buf . putLong ( message . m_sourceHSId ) ; buf . putInt ( destinations . length ) ; for ( int ii = 0 ; ii < destinations . length ; ii ++ ) { buf . putLong ( destinations [ ii ] ) ; } message . flattenToBuffer ( buf ) ; buf . flip ( ) ; } @ Override public final void cancel ( ) { /* * Can this be removed? */ } @ Override public String toString ( ) { return message . getClass ( ) . getName ( ) ; } @ Override public int getSerializedSize ( ) { final int len = 4 /* length prefix */ + 8 /* source hsid */ + 4 /* destinationCount */ + 8 * destinations . length /* destination list */ + message . getSerializedSize ( ) ; return len ; } } ) ; } long current_time = EstTime . currentTimeMillis ( ) ; long current_delta = current_time - m_lastMessageMillis . get ( ) ; /* * Try and give some warning when a connection is timing out. * Allows you to observe the liveness of the host receiving the heartbeats */ if ( isPrimary ( ) && current_delta > m_logRate ) { rateLimitedLogger . log ( "Have not received a message from host " + hostnameAndIPAndPort ( ) + " for " + ( current_delta / 1000.0 ) + " seconds" , current_time ) ; } // NodeFailureFault no longer immediately trips FHInputHandler to // set m_isUp to false, so use both that and m_closing to // avoid repeat reports of a single node failure if ( ( ! m_closing && m_isUp ) && isPrimary ( ) && current_delta > m_deadHostTimeout ) { if ( m_deadReportsCount . getAndIncrement ( ) == 0 ) { hostLog . error ( "DEAD HOST DETECTED, hostname: " + hostnameAndIPAndPort ( ) ) ; hostLog . info ( "\tcurrent time: " + current_time ) ; hostLog . info ( "\tlast message: " + m_lastMessageMillis ) ; hostLog . info ( "\tdelta (millis): " + current_delta ) ; hostLog . info ( "\ttimeout value (millis): " + m_deadHostTimeout ) ; VoltDB . dropStackTrace ( "Timed out foreign host " + hostnameAndIPAndPort ( ) + " with delta " + current_delta ) ; } m_hostMessenger . reportForeignHostFailed ( m_hostId ) ; } }
Send a message to the network . This public method is re - entrant .