library/src/main/java/com/kdgregory/aws/utils/kinesis/KinesisWriter.java
/**
     *  Examines the results of the last send, retaining any records that weren't sent.
     *  Logs a warning if any records weren't sent.
     */
Examines the results of the last send, retaining any records that weren't sent.
Logs a warning if any records weren't sent.
Examines the results of the last send retaining any records that weren ' t sent . Logs a warning if any records weren ' t sent .
private void processResults()
    {
        clear();
        int successCount = 0;
        int failureCount = 0;
        Map<String,Integer> failureCountByCode = new TreeMap<String,Integer>();
        Map<String,String> failureDetailByCode = new TreeMap<String,String>();
        for (SendResult entry : lastSendResults)
        {
            String errorCode = entry.getResultEntry().getErrorCode();
            if ((errorCode != null) && (errorCode.length() > 0))
            {
                failureCount++;
                Integer count = failureCountByCode.get(errorCode);
                count = (count != null)
                      ? count + 1
                      : Integer.valueOf(1);
                failureCountByCode.put(errorCode, count);
                failureDetailByCode.put(errorCode, entry.getResultEntry().getErrorMessage());
                addRecord(entry.getRequestEntry().getPartitionKey(), entry.getRequestEntry().getData().array());
            }
            else
            {
                successCount++;
            }
        }
        if (logger.isDebugEnabled())
        {
            logger.debug("sent " + successCount + " of " + (successCount + failureCount) + " records to " + streamName);
        }
        for (String errorType : failureCountByCode.keySet())
        {
            logger.warn("failed to send " + failureCountByCode.get(errorType)
                        + " records to " + streamName + " due to " + errorType
                        + " (sample message: " + failureDetailByCode.get(errorType) + ")");
        }
    }
private void processResults ( ) { clear ( ) ; int successCount = 0 ; int failureCount = 0 ; Map < String , Integer > failureCountByCode = new TreeMap < String , Integer > ( ) ; Map < String , String > failureDetailByCode = new TreeMap < String , String > ( ) ; for ( SendResult entry : lastSendResults ) { String errorCode = entry . getResultEntry ( ) . getErrorCode ( ) ; if ( ( errorCode != null ) && ( errorCode . length ( ) > 0 ) ) { failureCount ++ ; Integer count = failureCountByCode . get ( errorCode ) ; count = ( count != null ) ? count + 1 : Integer . valueOf ( 1 ) ; failureCountByCode . put ( errorCode , count ) ; failureDetailByCode . put ( errorCode , entry . getResultEntry ( ) . getErrorMessage ( ) ) ; addRecord ( entry . getRequestEntry ( ) . getPartitionKey ( ) , entry . getRequestEntry ( ) . getData ( ) . array ( ) ) ; } else { successCount ++ ; } } if ( logger . isDebugEnabled ( ) ) { logger . debug ( "sent " + successCount + " of " + ( successCount + failureCount ) + " records to " + streamName ) ; } for ( String errorType : failureCountByCode . keySet ( ) ) { logger . warn ( "failed to send " + failureCountByCode . get ( errorType ) + " records to " + streamName + " due to " + errorType + " (sample message: " + failureDetailByCode . get ( errorType ) + ")" ) ; } }
Examines the results of the last send, retaining any records that weren't sent.
Examines the results of the last send retaining any records that weren ' t sent .
// rather than duplicate code, we'll just reuse the addRecord() code, so must // start by clearing the current list of unsent records