-
Notifications
You must be signed in to change notification settings - Fork 845
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace ArrayBlockingQueue with jctools queue. (#3034)
* Replace ArrayBlockingQueue with jctools queue. * Finish * ArrayQueue * Fix dependency * Drift * Memory note * Iteration
- Loading branch information
Anuraag Agrawal
authored
Mar 31, 2021
1 parent
c667636
commit 2f2af19
Showing
11 changed files
with
82 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
plugins { | ||
`java-library` | ||
|
||
id("com.github.johnrengelman.shadow") | ||
} | ||
|
||
// This project is not published, it is bundled into :sdk:trace | ||
|
||
description = "Internal use only - shaded dependencies of OpenTelemetry SDK for Tracing" | ||
extra["moduleName"] = "io.opentelemetry.sdk.trace.internal" | ||
|
||
dependencies { | ||
implementation("org.jctools:jctools-core") | ||
} | ||
|
||
tasks { | ||
shadowJar { | ||
minimize() | ||
|
||
relocate("org.jctools", "io.opentelemetry.internal.shaded.jctools") | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
sdk/trace-shaded-deps/src/main/java/io/opentelemetry/sdk/trace/internal/JcTools.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.sdk.trace.internal; | ||
|
||
import java.util.Queue; | ||
import org.jctools.queues.MessagePassingQueue; | ||
import org.jctools.queues.MpscArrayQueue; | ||
|
||
/** Internal accessor of JCTools package for fast queues. */ | ||
public final class JcTools { | ||
|
||
/** | ||
* Returns a new {@link Queue} appropriate for use with multiple producers and a single consumer. | ||
*/ | ||
public static <T> Queue<T> newMpscArrayQueue(int capacity) { | ||
return new MpscArrayQueue<>(capacity); | ||
} | ||
|
||
/** | ||
* Returns the capacity of the {@link Queue}, which must be a JcTools queue. We cast to the | ||
* implementation so callers do not need to use the shaded classes. | ||
*/ | ||
public static long capacity(Queue<?> queue) { | ||
return ((MessagePassingQueue<?>) queue).capacity(); | ||
} | ||
|
||
private JcTools() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters