001/*
002 * The contents of this file are subject to the terms of the Common Development and
003 * Distribution License (the License). You may not use this file except in compliance with the
004 * License.
005 *
006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
007 * specific language governing permission and limitations under the License.
008 *
009 * When distributing Covered Software, include this CDDL Header Notice in each file and include
010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
011 * Header, with the fields enclosed by brackets [] replaced by your own identifying
012 * information: "Portions copyright [year] [name of copyright owner]".
013 *
014 * Copyright 2016 ForgeRock AS.
015 */
016
017package org.forgerock.audit.batch;
018
019import java.util.concurrent.TimeUnit;
020
021import org.forgerock.util.time.Duration;
022
023/**
024 * This class stores the common audit logging batch process configurations.
025 *
026 * Asynchronous audit event handlers write events to a queue allowing the producer thread to return
027 * immediately rather than waiting for the audit event to be written to a file or socket.
028 *
029 * The queue is read by one or more consumer threads. When the queue is empty, these consumer threads
030 * go into a polling (blocked) state until a new event is added to the queue.
031 *
032 * In order to allow these consumer threads to be shutdown, when waiting for events to appear in the
033 * queue, these threads periodically awake to check for shutdown; by default, this period is set to
034 * 100ms.
035 *
036 */
037public final class CommonAuditBatchConfiguration {
038
039    /**
040     * Common Audit Batch log records queue polling timeout.
041     * Details: {@link CommonAuditBatchConfiguration}
042     */
043    public static final long POLLING_TIMEOUT = 100L;
044
045    /**
046     * Common Audit Batch log records queue polling timeout unit.
047     * Details: {@link CommonAuditBatchConfiguration}
048     */
049    public static final TimeUnit POLLING_TIMEOUT_UNIT = TimeUnit.MILLISECONDS;
050
051    /**
052     * Common Audit Batch log records queue polling timeout as {@link org.forgerock.util.time.Duration}.
053     * Details: {@link CommonAuditBatchConfiguration}
054     */
055    public static final Duration POLLING_INTERVAL = Duration.duration(POLLING_TIMEOUT, POLLING_TIMEOUT_UNIT);
056
057    private CommonAuditBatchConfiguration() {
058        //private constructor
059    }
060}