library/src/main/java/com/kdgregory/aws/utils/cloudwatch/CloudWatchLogsWriter.java
/**
     *  Adds a message to the queue, with specified timestamp.
     *
     *  @throws IllegalArgumentException if the message it too large to fit in a
     *          batch (even by itself) or the timestamp does not within the allowed
     *          range. Note that a message may accepted here but rejected during
     *          {@link #flush}, either because of a delay between add and flush or
     *          because the log group has a shorter retention period.
     *  @throws IllegalStateException if called after {@link #shutdown}.
     */
Adds a message to the queue, with specified timestamp.
@throws IllegalArgumentException if the message it too large to fit in a
batch (even by itself) or the timestamp does not within the allowed
range. Note that a message may accepted here but rejected during
#flush, either because of a delay between add and flush or
because the log group has a shorter retention period.
@throws IllegalStateException if called after  #shutdown.
Adds a message to the queue with specified timestamp . @throws IllegalArgumentException if the message it too large to fit in a batch ( even by itself ) or the timestamp does not within the allowed range . Note that a message may accepted here but rejected during #flush either because of a delay between add and flush or because the log group has a shorter retention period . @throws IllegalStateException if called after #shutdown .
public void add(long timestamp, String message)
    {
        if (isShutdown)
        {
            throw new IllegalStateException(
                        "writer has shut down"
                        + " (stream: " + logGroupName + "/" + logStreamName + ")");
        }
        long earliestAllowedTimestamp = System.currentTimeMillis() - 14 * 86400000;
        if (timestamp < earliestAllowedTimestamp)
        {
            throw new IllegalArgumentException(
                        "message timestamp too far in past"
                        + " (stream: " + logGroupName + "/" + logStreamName + ")"
                        + ": " + timestamp
                        + "; limit: " + earliestAllowedTimestamp);
        }
        long latestAllowedTimestamp = System.currentTimeMillis() + 2 * 3600000;
        if (timestamp > latestAllowedTimestamp)
        {
            throw new IllegalArgumentException(
                        "message timestamp too far in future"
                        + " (stream: " + logGroupName + "/" + logStreamName + ")"
                        + ": " + timestamp
                        + "; limit: " + latestAllowedTimestamp);
        }
        QueuedMessage qmessage = new QueuedMessage(timestamp, message);
        long sizeLimit = 1024 * 1024 - 26;
        if (qmessage.size > sizeLimit)
        {
            throw new IllegalArgumentException(
                        "message is too large"
                        + " (stream: " + logGroupName + "/" + logStreamName + ")"
                        + ": " + qmessage.size + " bytes"
                        + "; limit: " + sizeLimit);
        }
        unsentMessages.add(qmessage);
    }
public void add ( long timestamp , String message ) { if ( isShutdown ) { throw new IllegalStateException ( "writer has shut down" + " (stream: " + logGroupName + "/" + logStreamName + ")" ) ; } long earliestAllowedTimestamp = System . currentTimeMillis ( ) - 14 * 86400000 ; if ( timestamp < earliestAllowedTimestamp ) { throw new IllegalArgumentException ( "message timestamp too far in past" + " (stream: " + logGroupName + "/" + logStreamName + ")" + ": " + timestamp + "; limit: " + earliestAllowedTimestamp ) ; } long latestAllowedTimestamp = System . currentTimeMillis ( ) + 2 * 3600000 ; if ( timestamp > latestAllowedTimestamp ) { throw new IllegalArgumentException ( "message timestamp too far in future" + " (stream: " + logGroupName + "/" + logStreamName + ")" + ": " + timestamp + "; limit: " + latestAllowedTimestamp ) ; } QueuedMessage qmessage = new QueuedMessage ( timestamp , message ) ; long sizeLimit = 1024 * 1024 - 26 ; if ( qmessage . size > sizeLimit ) { throw new IllegalArgumentException ( "message is too large" + " (stream: " + logGroupName + "/" + logStreamName + ")" + ": " + qmessage . size + " bytes" + "; limit: " + sizeLimit ) ; } unsentMessages . add ( qmessage ) ; }
Adds a message to the queue, with specified timestamp.
Adds a message to the queue with specified timestamp .