Skip to content

Commit

Permalink
Remove encoder
Browse files Browse the repository at this point in the history
  • Loading branch information
wsargent committed Mar 7, 2020
1 parent 18f3638 commit 584f9be
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 247 deletions.
1 change: 1 addition & 0 deletions logback-correlationid/logback-correlationid.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ dependencies {
implementation project(":logback-classic")
implementation project(":logback-jdbc-appender")
implementation project(":logback-uniqueid-appender")
implementation project(":logback-ringbuffer")

testImplementation "com.h2database:h2:1.4.200"
testImplementation 'org.awaitility:awaitility:4.0.2'
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.jctools.queues.MessagePassingQueue;
import org.jctools.queues.MpmcArrayQueue;

/** An implementation of ring buffer using a multi-producer/multi-consumer array queue. */
public class MessagePassingQueueRingBuffer extends RingBufferBase {

// https://psy-lob-saw.blogspot.com/2015/01/mpmc-multi-multi-queue-vs-clq.html
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.tersesystems.logback.ringbuffer;

import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.encoder.Encoder;
import ch.qos.logback.core.spi.AppenderAttachableImpl;
import ch.qos.logback.core.spi.FilterReply;
import com.tersesystems.logback.core.DefaultAppenderAttachable;
Expand All @@ -11,26 +10,12 @@
public class RingBufferAwareAppender extends AbstractRingBufferAppender<ILoggingEvent>
implements DefaultAppenderAttachable<ILoggingEvent> {

protected final BufferedLoggingEventFactory eventFactory = new BufferedLoggingEventFactory();

private Encoder<ILoggingEvent> encoder;

private final AppenderAttachableImpl<ILoggingEvent> aai = new AppenderAttachableImpl<>();

// Provide a transform function we can override in subclasses
protected Function<ILoggingEvent, ILoggingEvent> transformFunction =
e -> {
byte[] encodedData = getEncoder().encode(e);
return eventFactory.create(e, encodedData);
};

public Encoder<ILoggingEvent> getEncoder() {
return encoder;
}

public void setEncoder(Encoder<ILoggingEvent> encoder) {
this.encoder = encoder;
}
// This gives us the option of doing encoding or isolating event logic without requiring
// anything at base level
protected Function<ILoggingEvent, ILoggingEvent> transformFunction = Function.identity();

@Override
public AppenderAttachableImpl<ILoggingEvent> appenderAttachableImpl() {
Expand All @@ -47,10 +32,6 @@ public void setTransformFunction(Function<ILoggingEvent, ILoggingEvent> transfor

@Override
public void start() {
if (this.encoder == null) {
addError("Null encoder!");
return;
}
super.start();
}

Expand Down

0 comments on commit 584f9be

Please sign in to comment.