mil.dod.th.remote.client/src/mil/dod/th/remote/client/impl/MessageSenderServiceImpl.java
private void sendMessage(final int destId, final TerraHarvestPayload payload, final boolean isResponse)
            throws IOException
    {
        Preconditions.checkState(m_ClientId != null, "Client ID is not set");

        final RemoteChannelInfo channelInfo = m_ChannelMap.get(destId);

        Preconditions.checkArgument(channelInfo != null, CHANNEL_MISSING_ERROR_MSG, destId);

        final TerraHarvestMessage thMessage = TerraHarvestMessage.newBuilder()
            .setSourceId(m_ClientId)
            .setDestId(destId)
            .setEncryptType(EncryptType.NONE)
            .setIsResponse(isResponse)
            .setMessageId(m_MessageId++)
            .setVersion(RemoteConstants.SPEC_VERSION)
            .setTerraHarvestPayload(payload.toByteString())
            .build();

        try
        {
            thMessage.writeDelimitedTo(channelInfo.getOutStream());
        }
        catch (final IOException ex)
        {
            final ChannelStateCallback callback = channelInfo.getCallback();
            if (callback != null)
            {
                callback.onChannelRemoved(destId, ex);
            }

            throw ex;
        }
    }
/**
     * Helper method used to send messages to the given destination ID.
     * 
     * @param destId
     *      ID of the destination system
     * @param payload
     *      payload message created by a message generator
     * @param isResponse
     *      flag indicating whether message is a response or not
     * @throws IOException
     *      if there is an I/O error on the associated output stream
     */
Helper method used to send messages to the given destination ID.

@param destId
ID of the destination system
@param payload
payload message created by a message generator
@param isResponse
flag indicating whether message is a response or not
@throws IOException
if there is an I/O error on the associated output stream
Helper method used to send messages to the given destination ID . @param destId ID of the destination system @param payload payload message created by a message generator @param isResponse flag indicating whether message is a response or not @throws IOException if there is an I / O error on the associated output stream
private void sendMessage(final int destId, final TerraHarvestPayload payload, final boolean isResponse)
            throws IOException
    {
        Preconditions.checkState(m_ClientId != null, "Client ID is not set");
        final RemoteChannelInfo channelInfo = m_ChannelMap.get(destId);
        Preconditions.checkArgument(channelInfo != null, CHANNEL_MISSING_ERROR_MSG, destId);
        final TerraHarvestMessage thMessage = TerraHarvestMessage.newBuilder()
            .setSourceId(m_ClientId)
            .setDestId(destId)
            .setEncryptType(EncryptType.NONE)
            .setIsResponse(isResponse)
            .setMessageId(m_MessageId++)
            .setVersion(RemoteConstants.SPEC_VERSION)
            .setTerraHarvestPayload(payload.toByteString())
            .build();
        try
        {
            thMessage.writeDelimitedTo(channelInfo.getOutStream());
        }
        catch (final IOException ex)
        {
            final ChannelStateCallback callback = channelInfo.getCallback();
            if (callback != null)
            {
                callback.onChannelRemoved(destId, ex);
            }
            throw ex;
        }
    }
private void sendMessage ( final int destId , final TerraHarvestPayload payload , final boolean isResponse ) throws IOException { Preconditions . checkState ( m_ClientId != null , "Client ID is not set" ) ; final RemoteChannelInfo channelInfo = m_ChannelMap . get ( destId ) ; Preconditions . checkArgument ( channelInfo != null , CHANNEL_MISSING_ERROR_MSG , destId ) ; final TerraHarvestMessage thMessage = TerraHarvestMessage . newBuilder ( ) . setSourceId ( m_ClientId ) . setDestId ( destId ) . setEncryptType ( EncryptType . NONE ) . setIsResponse ( isResponse ) . setMessageId ( m_MessageId ++ ) . setVersion ( RemoteConstants . SPEC_VERSION ) . setTerraHarvestPayload ( payload . toByteString ( ) ) . build ( ) ; try { thMessage . writeDelimitedTo ( channelInfo . getOutStream ( ) ) ; } catch ( final IOException ex ) { final ChannelStateCallback callback = channelInfo . getCallback ( ) ; if ( callback != null ) { callback . onChannelRemoved ( destId , ex ) ; } throw ex ; } }
Helper method used to send messages to the given destination ID.
Helper method used to send messages to the given destination ID .