Github user tflobbe commented on a diff in the pull request:

    https://github.com/apache/lucene-solr/pull/342#discussion_r176736293
  
    --- Diff: 
solr/core/src/java/org/apache/solr/security/AuditLoggerPlugin.java ---
    @@ -0,0 +1,135 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.solr.security;
    +
    +import java.io.Closeable;
    +import java.io.IOException;
    +import java.io.StringWriter;
    +import java.lang.invoke.MethodHandles;
    +import java.util.Map;
    +import java.util.concurrent.ArrayBlockingQueue;
    +import java.util.concurrent.BlockingQueue;
    +import java.util.concurrent.ExecutorService;
    +import java.util.concurrent.Executors;
    +
    +import com.fasterxml.jackson.databind.ObjectMapper;
    +import com.fasterxml.jackson.databind.SerializationFeature;
    +import org.apache.solr.common.SolrException;
    +import org.apache.solr.common.util.SolrjNamedThreadFactory;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +
    +/**
    + * Base class for Audit logger plugins
    + */
    +public abstract class AuditLoggerPlugin implements Closeable, Runnable {
    +  private static final Logger log = 
LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
    +
    +  private static final String PARAM_BLOCKASYNC = "blockAsync";
    +  private static final String PARAM_QUEUE_SIZE = "queueSize";
    +  protected AuditEventFormatter formatter;
    +  private BlockingQueue<AuditEvent> queue;
    +  private boolean blockAsync;
    +  private int blockingQueueSize;
    +
    +  /**
    +   * Audits an event. The event should be a {@link AuditEvent} to be able 
to pull context info.
    +   * @param event
    +   */
    +  public final void auditAsync(AuditEvent event) {
    +    if (blockAsync) {
    +      try {
    +        queue.put(event);
    +      } catch (InterruptedException e) {
    +        log.warn("Interrupted while waiting to insert AuditEvent into 
blocking queue");
    --- End diff --
    
    Does it makes sense to restore the interruption flag here?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to