Skip to content

Commit 6a59e03

Browse files
committed
Merge remote-tracking branch 'apache/main' into feature/main/2229_mongodb_docker
2 parents 136cc6f + fda45ec commit 6a59e03

File tree

76 files changed

+1216
-365
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+1216
-365
lines changed

.github/generate-email.sh

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,6 @@ RELEASE_NOTES_FILE="$SCRIPT_DIR/../target/generated-site/antora/modules/ROOT/pag
5252
exit 1
5353
}
5454

55-
dump_review_kit() {
56-
wget -q -O - https://raw.githubusercontent.com/apache/logging-parent/main/.github/release-review-kit.txt \
57-
| sed -n '/-----8<-----~( cut here )~-----8<-----/,$p' \
58-
| tail -n +2 \
59-
| sed -e "s|^| |g
60-
s|@PROJECT_ID@|$PROJECT_ID|g
61-
s|@PROJECT_VERSION@|$PROJECT_VERSION|g
62-
s|@PROJECT_DIST_URL@|$PROJECT_DIST_URL|g
63-
s|@COMMIT_ID@|${COMMIT_ID:0:8}|g"
64-
}
65-
6655
dump_release_notes() {
6756
awk "f{print} /^Release date::/{f=1}" "$RELEASE_NOTES_FILE" \
6857
| sed -r -e 's|'$PROJECT_REPO'/(issues|pull)/[0-9]+\[([0-9]+)\]|#\2|g
@@ -84,6 +73,7 @@ Commit: $COMMIT_ID
8473
Distribution: $PROJECT_DIST_URL
8574
Nexus: https://repository.apache.org/content/repositories/orgapachelogging-<FIXME>
8675
Signing key: 0x077e8893a6dcc33dd4a4d5b256e73ba9a0b592d0
76+
Review kit: https://s.apache.org/logging-parent-release-review-kit
8777
8878
Please download, test, and cast your votes on this mailing list.
8979
@@ -96,13 +86,6 @@ everyone to test the release, but only the Logging Services PMC
9686
votes are officially counted. At least 3 +1 votes and more
9787
positive than negative votes are required.
9888
99-
== Review kit
100-
101-
The minimum set of steps needed to review the uploaded distribution
102-
files in the Subversion repository can be summarized as follows:
103-
104-
$(dump_review_kit)
105-
10689
== Release Notes
10790
EOF
10891
dump_release_notes

log4j-async-logger/src/test/java/org/apache/logging/log4j/async/logger/AsyncLoggerConfigTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ public void testSingleFilterInvocation() {
111111
disruptor.start();
112112
try {
113113
config.log(FQCN, FQCN, null, Level.INFO, new SimpleMessage(), null);
114-
verify(appender, timeout(100).times(1)).append(any());
114+
// If this fails, the log event might not have reached the asynchronous thread yet
115+
verify(appender, timeout(1000).times(1)).append(any());
115116
verify(filter, times(1)).filter(any());
116117
} finally {
117118
disruptor.stop();
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This file is here to activate the `plugin-processing` Maven profile.

log4j-conversant/pom.xml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Licensed to the Apache Software Foundation (ASF) under one or more
4+
~ contributor license agreements. See the NOTICE file distributed with
5+
~ this work for additional information regarding copyright ownership.
6+
~ The ASF licenses this file to you under the Apache License, Version 2.0
7+
~ (the "License"); you may not use this file except in compliance with
8+
~ the License. You may obtain a copy of the License at
9+
~
10+
~ http://www.apache.org/licenses/LICENSE-2.0
11+
~
12+
~ Unless required by applicable law or agreed to in writing, software
13+
~ distributed under the License is distributed on an "AS IS" BASIS,
14+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
~ See the License for the specific language governing permissions and
16+
~ limitations under the License.
17+
-->
18+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
19+
<modelVersion>4.0.0</modelVersion>
20+
<parent>
21+
<groupId>org.apache.logging.log4j</groupId>
22+
<artifactId>log4j</artifactId>
23+
<version>${revision}</version>
24+
<relativePath>../log4j-parent</relativePath>
25+
</parent>
26+
27+
<artifactId>log4j-conversant</artifactId>
28+
<name>Apache Log4j Conversant Disruptor-based supplements</name>
29+
<description>Provides ConversantMedia Disruptor-based data structure implementations for the Apache Log4j.</description>
30+
31+
<properties>
32+
<conversant.disruptor.version>1.2.21</conversant.disruptor.version>
33+
</properties>
34+
35+
<dependencyManagement>
36+
<dependencies>
37+
38+
<dependency>
39+
<groupId>com.conversantmedia</groupId>
40+
<artifactId>disruptor</artifactId>
41+
<version>${conversant.disruptor.version}</version>
42+
</dependency>
43+
44+
</dependencies>
45+
</dependencyManagement>
46+
47+
<dependencies>
48+
49+
<dependency>
50+
<groupId>org.jspecify</groupId>
51+
<artifactId>jspecify</artifactId>
52+
<scope>provided</scope>
53+
</dependency>
54+
55+
<dependency>
56+
<groupId>com.conversantmedia</groupId>
57+
<artifactId>disruptor</artifactId>
58+
</dependency>
59+
60+
<dependency>
61+
<groupId>org.apache.logging.log4j</groupId>
62+
<artifactId>log4j-core</artifactId>
63+
</dependency>
64+
65+
<dependency>
66+
<groupId>org.apache.logging.log4j</groupId>
67+
<artifactId>log4j-plugins</artifactId>
68+
</dependency>
69+
70+
<dependency>
71+
<groupId>org.assertj</groupId>
72+
<artifactId>assertj-core</artifactId>
73+
<scope>test</scope>
74+
</dependency>
75+
76+
<dependency>
77+
<groupId>org.junit.jupiter</groupId>
78+
<artifactId>junit-jupiter-api</artifactId>
79+
<scope>test</scope>
80+
</dependency>
81+
82+
<dependency>
83+
<groupId>org.apache.logging.log4j</groupId>
84+
<artifactId>log4j-core-test</artifactId>
85+
<scope>test</scope>
86+
</dependency>
87+
88+
</dependencies>
89+
90+
</project>
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,25 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17-
package org.apache.logging.log4j.core.async;
17+
package org.apache.logging.log4j.conversant;
1818

1919
import com.conversantmedia.util.concurrent.DisruptorBlockingQueue;
2020
import com.conversantmedia.util.concurrent.SpinPolicy;
2121
import java.util.concurrent.BlockingQueue;
22+
import org.apache.logging.log4j.core.async.BlockingQueueFactory;
2223
import org.apache.logging.log4j.plugins.Configurable;
2324
import org.apache.logging.log4j.plugins.Plugin;
2425
import org.apache.logging.log4j.plugins.PluginAttribute;
2526
import org.apache.logging.log4j.plugins.PluginFactory;
2627

2728
/**
28-
* Factory for creating instances of {@link DisruptorBlockingQueue}.
29+
* A {@link BlockingQueueFactory} based on <a href="/conversant/disruptor">Conversant Disruptor BlockingQueue</a>.
2930
*
30-
* @since 2.7
31+
* @since 3.0.0
3132
*/
3233
@Configurable(elementType = BlockingQueueFactory.ELEMENT_TYPE, printObject = true)
3334
@Plugin("DisruptorBlockingQueue")
34-
public class DisruptorBlockingQueueFactory implements BlockingQueueFactory {
35+
public final class DisruptorBlockingQueueFactory implements BlockingQueueFactory {
3536

3637
private final SpinPolicy spinPolicy;
3738

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to you under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
package org.apache.logging.log4j.conversant;
18+
19+
import static java.util.Objects.requireNonNull;
20+
21+
import aQute.bnd.annotation.spi.ServiceProvider;
22+
import com.conversantmedia.util.concurrent.DisruptorBlockingQueue;
23+
import com.conversantmedia.util.concurrent.SpinPolicy;
24+
import java.util.Queue;
25+
import java.util.function.Consumer;
26+
import java.util.function.Supplier;
27+
import org.apache.logging.log4j.Logger;
28+
import org.apache.logging.log4j.core.util.Integers;
29+
import org.apache.logging.log4j.kit.env.PropertyEnvironment;
30+
import org.apache.logging.log4j.kit.recycler.Recycler;
31+
import org.apache.logging.log4j.kit.recycler.RecyclerFactory;
32+
import org.apache.logging.log4j.kit.recycler.RecyclerFactoryProvider;
33+
import org.apache.logging.log4j.kit.recycler.RecyclerProperties;
34+
import org.apache.logging.log4j.kit.recycler.support.AbstractRecycler;
35+
import org.apache.logging.log4j.status.StatusLogger;
36+
37+
/**
38+
* A {@link Recycler} factory provider implementation based on
39+
* <a href="https://github.com/conversant/disruptor>Conversant's Disruptor BlockingQueue</a>.
40+
*
41+
* @since 3.0.0
42+
*/
43+
@ServiceProvider(value = RecyclerFactoryProvider.class)
44+
public final class DisruptorRecyclerFactoryProvider implements RecyclerFactoryProvider {
45+
46+
private static final Logger LOGGER = StatusLogger.getLogger();
47+
48+
@Override
49+
public int getOrder() {
50+
return 600;
51+
}
52+
53+
@Override
54+
public String getName() {
55+
return "conversant-disruptor";
56+
}
57+
58+
@Override
59+
public RecyclerFactory createForEnvironment(final PropertyEnvironment environment) {
60+
requireNonNull(environment, "environment");
61+
return new DisruptorRecyclerFactory(
62+
environment.getProperty(RecyclerProperties.class),
63+
environment.getProperty(DisruptorRecyclerProperties.class));
64+
}
65+
66+
private static final class DisruptorRecyclerFactory implements RecyclerFactory {
67+
68+
/**
69+
* Minimum capacity of the disruptor
70+
*/
71+
private static final int MIN_CAPACITY = 8;
72+
73+
private final int capacity;
74+
private final SpinPolicy spinPolicy;
75+
76+
private DisruptorRecyclerFactory(
77+
final RecyclerProperties recyclerProperties, final DisruptorRecyclerProperties disruptorProperties) {
78+
this.capacity = validateCapacity(recyclerProperties.capacity());
79+
this.spinPolicy = disruptorProperties.spinPolicy();
80+
}
81+
82+
@Override
83+
public <V> Recycler<V> create(final Supplier<V> supplier, final Consumer<V> cleaner) {
84+
requireNonNull(supplier, "supplier");
85+
requireNonNull(cleaner, "cleaner");
86+
final DisruptorBlockingQueue<V> queue = new DisruptorBlockingQueue<>(capacity, spinPolicy);
87+
return new DisruptorRecycler<>(supplier, cleaner, queue);
88+
}
89+
90+
private static Integer validateCapacity(final int capacity) {
91+
if (capacity < MIN_CAPACITY) {
92+
LOGGER.warn(
93+
"Invalid DisruptorBlockingQueue capacity {}, using minimum size {}.", capacity, MIN_CAPACITY);
94+
return MIN_CAPACITY;
95+
}
96+
final int roundedCapacity = Integers.ceilingNextPowerOfTwo(capacity);
97+
if (capacity != roundedCapacity) {
98+
LOGGER.warn(
99+
"Invalid DisruptorBlockingQueue size {}, using rounded size {}.", capacity, roundedCapacity);
100+
}
101+
return roundedCapacity;
102+
}
103+
104+
private static final class DisruptorRecycler<V> extends AbstractRecycler<V> {
105+
106+
private final Consumer<V> cleaner;
107+
108+
private final Queue<V> queue;
109+
110+
private DisruptorRecycler(final Supplier<V> supplier, final Consumer<V> cleaner, final Queue<V> queue) {
111+
super(supplier);
112+
this.cleaner = cleaner;
113+
this.queue = queue;
114+
}
115+
116+
@Override
117+
public V acquire() {
118+
final V value = queue.poll();
119+
return value != null ? value : createInstance();
120+
}
121+
122+
@Override
123+
public void release(final V value) {
124+
requireNonNull(value, "value");
125+
cleaner.accept(value);
126+
queue.offer(value);
127+
}
128+
}
129+
}
130+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to you under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
package org.apache.logging.log4j.conversant;
18+
19+
import com.conversantmedia.util.concurrent.SpinPolicy;
20+
import org.apache.logging.log4j.kit.env.Log4jProperty;
21+
import org.jspecify.annotations.NullMarked;
22+
23+
@NullMarked
24+
@Log4jProperty(name = "recycler.conversant")
25+
public record DisruptorRecyclerProperties(@Log4jProperty(defaultValue = "WAITING") SpinPolicy spinPolicy) {}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to you under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
@Export
18+
@Version("3.0.0")
19+
package org.apache.logging.log4j.conversant;
20+
21+
import org.osgi.annotation.bundle.Export;
22+
import org.osgi.annotation.versioning.Version;

0 commit comments

Comments
 (0)