[Git][java-team/conversant-disruptor][upstream] 4 commits: New upstream version 1.2.12
Emmanuel Bourg
gitlab at salsa.debian.org
Fri Sep 13 08:41:39 BST 2019
Emmanuel Bourg pushed to branch upstream at Debian Java Maintainers / conversant-disruptor
Commits:
e26e6eb1 by Emmanuel Bourg at 2019-09-13T07:22:36Z
New upstream version 1.2.12
- - - - -
59114d62 by Emmanuel Bourg at 2019-09-13T07:23:25Z
New upstream version 1.2.13
- - - - -
a1720fe0 by Emmanuel Bourg at 2019-09-13T07:23:55Z
New upstream version 1.2.14
- - - - -
1f6b014e by Emmanuel Bourg at 2019-09-13T07:24:32Z
New upstream version 1.2.15
- - - - -
29 changed files:
- README.md
- RELEASE
- + benchmark/benchmark.jpg
- + benchmark/performance.dat
- + benchmark/performance.plt
- pom.xml
- src/test/java/com/conversantmedia/util/concurrent/ConcurrentQueuePerformanceTest.java → src/it/java/com/conversantmedia/util/concurrent/ConcurrentQueuePerformanceTest.java
- src/test/java/com/conversantmedia/util/concurrent/ConcurrentStackFeedTest.java → src/it/java/com/conversantmedia/util/concurrent/ConcurrentStackFeedTest.java
- src/test/java/com/conversantmedia/util/concurrent/ConcurrentStackPerformanceTest.java → src/it/java/com/conversantmedia/util/concurrent/ConcurrentStackPerformanceTest.java
- src/test/java/com/conversantmedia/util/concurrent/DisruptorFairSchedulingTest.java → src/it/java/com/conversantmedia/util/concurrent/DisruptorFairSchedulingTest.java
- src/test/java/com/conversantmedia/util/concurrent/DisruptorOfferPollStressTest.java → src/it/java/com/conversantmedia/util/concurrent/DisruptorOfferPollStressTest.java
- src/test/java/com/conversantmedia/util/concurrent/DisruptorPerformanceTest.java → src/it/java/com/conversantmedia/util/concurrent/DisruptorPerformanceTest.java
- src/test/java/com/conversantmedia/util/concurrent/DisruptorPerformanceTest2.java → src/it/java/com/conversantmedia/util/concurrent/DisruptorPerformanceTest2.java
- src/test/java/com/conversantmedia/util/concurrent/DisruptorPutTakeStressTest.java → src/it/java/com/conversantmedia/util/concurrent/DisruptorPutTakeStressTest.java
- src/test/java/com/conversantmedia/util/concurrent/DisruptorQueuePerfTest.java → src/it/java/com/conversantmedia/util/concurrent/DisruptorQueuePerfTest.java
- src/test/java/com/conversantmedia/util/concurrent/DisruptorStressTest.java → src/it/java/com/conversantmedia/util/concurrent/DisruptorStressTest.java
- src/test/java/com/conversantmedia/util/concurrent/MPMCConcurrentQueuePerfTest.java → src/it/java/com/conversantmedia/util/concurrent/MPMCConcurrentQueuePerfTest.java
- src/test/java/com/conversantmedia/util/concurrent/MultithreadConcurrentQueuePerfTest.java → src/it/java/com/conversantmedia/util/concurrent/MultithreadConcurrentQueuePerfTest.java
- src/test/java/com/conversantmedia/util/concurrent/PushPullConcurrentQueuePerfTest.java → src/it/java/com/conversantmedia/util/concurrent/PushPullConcurrentQueuePerfTest.java
- src/main/java/com/conversantmedia/util/concurrent/AbstractWaitingCondition.java
- + src/main/java/com/conversantmedia/util/concurrent/Capacity.java
- src/main/java/com/conversantmedia/util/concurrent/ConcurrentStack.java
- src/main/java/com/conversantmedia/util/concurrent/DisruptorBlockingQueue.java
- src/main/java/com/conversantmedia/util/concurrent/MPMCConcurrentQueue.java
- src/main/java/com/conversantmedia/util/concurrent/MultithreadConcurrentQueue.java
- src/main/java/com/conversantmedia/util/concurrent/PushPullConcurrentQueue.java
- + src/test/java/com/conversantmedia/util/concurrent/CapacityTest.java
- src/test/java/com/conversantmedia/util/concurrent/ConcurrentStackTest.java
- src/test/java/com/conversantmedia/util/concurrent/PushPullBlockingQueueTest.java
Changes:
=====================================
README.md
=====================================
@@ -1,38 +1,54 @@
<img src="https://github.com/conversant/disruptor/blob/master/src/main/resources/ConversantDisruptorLogo.png?raw=true">
-# Conversant ConcurrentQueue and Disruptor BlockingQueue
+# Conversant ConcurrentQueue, Disruptor BlockingQueue and ConcurrentStack
-Disruptor is the highest performing intra-thread transfer mechanism available in Java. Conversant Disruptor is the highest performing implementation of this type of ring buffer queue because it has almost no overhead and it exploits a particularly simple design.
+Disruptor is the highest performing intra-thread transfer mechanism available in Java. Conversant Disruptor is the highest performing implementation of this type of ring buffer because it has almost no overhead and it exploits a particularly simple design.
+
+<table>
+<td><img src="https://github.com/conversant/disruptor/blob/master/benchmark/benchmark.jpg?raw=true"></td><tr>
+<caption><strong>2017 Conversant Disruptor - Still the World's Fastest</strong></caption>
+</table>
# Getting Started
-Simply run the maven build to build and use the package.
+Run the maven build to build and use the package.
```$ mvn -U clean package```
# Conversant Disruptor is on Maven Central
-Maven Java 8 users can incorporate Conversant Disruptor the usual way:
+For Java 8, Include Conversant Disruptor from Maven Central:
```
<dependency>
<groupId>com.conversantmedia</groupId>
<artifactId>disruptor</artifactId>
- <version>1.2.10</version>
+ <version>1.2.14</version>
<classifier>jdk8</classifier>
</dependency>
```
-OR
+For Java 10:
```
<dependency>
<groupId>com.conversantmedia</groupId>
<artifactId>disruptor</artifactId>
- <version>1.2.10</version>
+ <version>1.2.14</version>
+ <classifier>jdk10</classifier>
</dependency>
```
-Java 7 is also supported
+Or through the default Java 8 jar
+
+```
+<dependency>
+ <groupId>com.conversantmedia</groupId>
+ <artifactId>disruptor</artifactId>
+ <version>1.2.14</version>
+</dependency>
+```
+
+Java 7 is only supported in 1.2.10 and below.
```
<dependency>
@@ -43,9 +59,10 @@ Java 7 is also supported
</dependency>
```
+Java 9 is no longer supported.
+
## Discussion Forum
Conversant Disruptor has a google group so you can follow releases and changes:
-
https://groups.google.com/forum/#!forum/conversant-disruptor
=====================================
RELEASE
=====================================
@@ -8,3 +8,4 @@
1.2.8 - Padding changes
1.2.9 - bug fixes
1.2.10 - major point release, cleanup, adding MPMC, @Contended annotation
+1.2.11 - Java 8 specific performance improvements, Java 7 no longer supported
=====================================
benchmark/benchmark.jpg
=====================================
Binary files /dev/null and b/benchmark/benchmark.jpg differ
=====================================
benchmark/performance.dat
=====================================
@@ -0,0 +1,6 @@
+Conversant 31.148
+MPMC 52.401
+LMAX 61.129
+LinkedTransferQueue 125.511
+ConcurrentStack 169.317
+ArrayBlockingQueue 376.906
=====================================
benchmark/performance.plt
=====================================
@@ -0,0 +1,11 @@
+reset
+set terminal jpeg
+set output "benchmark.jpg"
+set style fill solid 1.00 border 0
+set style histogram
+set style data histogram
+set xtics rotate by -45
+set grid ytics linestyle 1
+set xlabel "Conversant Disruptor vs Competition (Intel Xeon - Broadwell)" font "bold"
+set ylabel "time (ms)" font "bold"
+plot "performance.dat" using 2:xtic(1) ti "1M Transactions" linecolor rgb "#0066FF"
=====================================
pom.xml
=====================================
@@ -1,261 +1,296 @@
<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>com.conversantmedia</groupId>
- <artifactId>disruptor</artifactId>
- <packaging>jar</packaging>
- <version>1.2.11</version>
- <name>${project.groupId}:${project.artifactId}</name>
- <url>https://github.com/conversant/disruptor</url>
- <description>Conversant Disruptor - very low latency Java BlockingQueue</description>
-
- <inceptionYear>2012</inceptionYear>
-
- <organization>
- <name>Conversant Engineering</name>
- <url>http://engineering.conversantmedia.com</url>
- </organization>
-
- <developers>
- <developer>
- <name>John Cairns</name>
- <email>john at 2ad.com</email>
- <organization>Conversant, Inc.</organization>
- <organizationUrl>http://engineering.conversantmedia.com</organizationUrl>
- </developer>
- </developers>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>com.conversantmedia</groupId>
+ <artifactId>disruptor</artifactId>
+ <packaging>jar</packaging>
+ <version>1.2.15</version>
+ <name>${project.groupId}:${project.artifactId}</name>
+ <url>https://github.com/conversant/disruptor</url>
+ <description>Conversant Disruptor - very high throughput Java BlockingQueue</description>
- <licenses>
- <license>
- <name>The Apache License, Version 2.0</name>
- <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
- </license>
- </licenses>
+ <inceptionYear>2012</inceptionYear>
- <scm>
- <connection>scm:git:https://github.com/conversant/disruptor.git</connection>
- <developerConnection>scm:git:https://github.com/conversant/disruptor.git</developerConnection>
- <url>https://github.com/conversant/disruptor</url>
- <tag>HEAD</tag>
- </scm>
+ <organization>
+ <name>Conversant Engineering</name>
+ <url>http://engineering.conversantmedia.com</url>
+ </organization>
+
+ <developers>
+ <developer>
+ <name>John Cairns</name>
+ <email>john at 2ad.com</email>
+ <organizationUrl>https://github.com/jac18281828</organizationUrl>
+ </developer>
+ </developers>
+
+ <licenses>
+ <license>
+ <name>The Apache License, Version 2.0</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+ </license>
+ </licenses>
+
+ <scm>
+ <connection>scm:git:https://github.com/conversant/disruptor.git</connection>
+ <developerConnection>scm:git:https://github.com/conversant/disruptor.git</developerConnection>
+ <url>https://github.com/conversant/disruptor</url>
+ <tag>HEAD</tag>
+ </scm>
+
+ <distributionManagement>
+ <snapshotRepository>
+ <id>${snapshots.repo.id}</id>
+ <url>${snapshots.repo.url}</url>
+ </snapshotRepository>
+ <repository>
+ <id>ossrh</id>
+ <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
+ </repository>
+ </distributionManagement>
+
+ <issueManagement>
+ <system>GitHub</system>
+ <url>https://github.com/conversant/disruptor/issues</url>
+ </issueManagement>
+
+ <prerequisites>
+ <maven>3.0.2</maven>
+ </prerequisites>
+
+ <properties>
+ <jdk.version>1.8</jdk.version>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+ <snapshots.repo.id>ossrh</snapshots.repo.id>
+ <snapshots.repo.url>https://oss.sonatype.org/content/repositories/snapshots</snapshots.repo.url>
+ <license.name>apache_v2</license.name>
+ </properties>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ </resource>
+ </resources>
- <distributionManagement>
- <snapshotRepository>
- <id>${snapshots.repo.id}</id>
- <url>${snapshots.repo.url}</url>
- </snapshotRepository>
- <repository>
- <id>ossrh</id>
- <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
- </repository>
- </distributionManagement>
+ <testResources>
+ <testResource>
+ <directory>src/test/resources</directory>
+ </testResource>
+ </testResources>
- <issueManagement>
- <system>GitHub</system>
- <url>https://github.com/conversant/disruptor/issues</url>
- </issueManagement>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.6.0</version>
+ <inherited>true</inherited>
+ <configuration>
+ <source>${jdk.version}</source>
+ <target>${jdk.version}</target>
+ <encoding>${project.build.sourceEncoding}</encoding>
+ <!-- <executable>/usr/lib/jvm/jdk-9/bin/javac</executable> -->
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>license-maven-plugin</artifactId>
+ <version>1.8</version>
+ <configuration>
+ <licenseName>${license.name}</licenseName>
+ <sectionDelimiter>~~</sectionDelimiter>
+ <verbose>false</verbose>
+ <addSvnKeyWords>false</addSvnKeyWords>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.17</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <version>2.17</version>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <goals>
+ <goal>integration-test</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>verify</id>
+ <goals>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-report-plugin</artifactId>
+ <version>2.17</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-source-plugin</artifactId>
+ <version>2.2.1</version>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <goals>
+ <goal>jar-no-fork</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.9.1</version>
+ <executions>
+ <execution>
+ <id>attach-javadocs</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <classifier>${jdkClassifier}</classifier>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>2.6</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.4</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-release-plugin</artifactId>
+ <version>2.5</version>
+ <configuration>
+ <tagNameFormat>@{project.version}</tagNameFormat>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>cobertura-maven-plugin</artifactId>
+ <version>2.6</version>
+ <configuration>
+ <maxmem>1024m</maxmem>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.11</version>
+ <executions>
+ <execution>
+ <id>add-integration-test-source</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>add-test-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>src/it/java</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-site-plugin</artifactId>
+ <version>3.3</version>
+ </plugin>
+ <plugin>
+ <groupId>org.sonatype.plugins</groupId>
+ <artifactId>nexus-staging-maven-plugin</artifactId>
+ <version>1.6.3</version>
+ <extensions>true</extensions>
+ <configuration>
+ <serverId>ossrh</serverId>
+ <nexusUrl>https://oss.sonatype.org/</nexusUrl>
+ <autoReleaseAfterClose>true</autoReleaseAfterClose>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-gpg-plugin</artifactId>
+ <version>1.5</version>
+ <executions>
+ <execution>
+ <id>sign-artifacts</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>sign</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
- <prerequisites>
- <maven>3.0.2</maven>
- </prerequisites>
-
- <properties>
- <jdk.version>1.8</jdk.version>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- <snapshots.repo.id>ossrh</snapshots.repo.id>
- <snapshots.repo.url>https://oss.sonatype.org/content/repositories/snapshots</snapshots.repo.url>
- <license.name>apache_v2</license.name>
- </properties>
+ <profiles>
+ <!-- Java 7 is no longer supported as of release 1.2.11 -->
+ <!-- Java 9 is no longer supported as of release 1.2.12 -->
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <properties>
+ <jdkClassifier></jdkClassifier>
+ </properties>
+ </profile>
+ <profile>
+ <id>jdk8</id>
+ <activation>
+ <jdk>1.8</jdk>
+ </activation>
+ <properties>
+ <jdkClassifier>jdk8</jdkClassifier>
+ </properties>
+ </profile>
+ <profile>
+ <id>jdk10</id>
+ <activation>
+ <jdk>10</jdk>
+ </activation>
+ <properties>
+ <jdkClassifier>jdk10</jdkClassifier>
+ </properties>
+ </profile>
+ </profiles>
- <build>
- <pluginManagement>
- <plugins>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.6.0</version>
- <inherited>true</inherited>
- <configuration>
- <source>${jdk.version}</source>
- <target>${jdk.version}</target>
- <encoding>${project.build.sourceEncoding}</encoding>
- <!-- <executable>/usr/lib/jvm/jdk-9/bin/javac</executable> -->
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>license-maven-plugin</artifactId>
- <version>1.8</version>
- <configuration>
- <licenseName>${license.name}</licenseName>
- <sectionDelimiter>~~</sectionDelimiter>
- <verbose>false</verbose>
- <addSvnKeyWords>false</addSvnKeyWords>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.17</version>
- </plugin>
- <plugin>
- <artifactId>maven-failsafe-plugin</artifactId>
- <version>2.17</version>
- <executions>
- <execution>
- <id>integration-test</id>
- <goals>
- <goal>integration-test</goal>
- </goals>
- </execution>
- <execution>
- <id>verify</id>
- <goals>
- <goal>verify</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-surefire-report-plugin</artifactId>
- <version>2.17</version>
- </plugin>
- <plugin>
- <artifactId>maven-source-plugin</artifactId>
- <version>2.2.1</version>
- <executions>
- <execution>
- <id>attach-sources</id>
- <goals>
- <goal>jar-no-fork</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-javadoc-plugin</artifactId>
- <version>2.9.1</version>
- <executions>
- <execution>
- <id>attach-javadocs</id>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-jar-plugin</artifactId>
- <configuration>
- <classifier>${jdkClassifier}</classifier>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-resources-plugin</artifactId>
- <version>2.6</version>
- </plugin>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <version>2.4</version>
- </plugin>
- <plugin>
- <artifactId>maven-release-plugin</artifactId>
- <version>2.5</version>
- <configuration>
- <tagNameFormat>@{project.version}</tagNameFormat>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>cobertura-maven-plugin</artifactId>
- <version>2.6</version>
- <configuration>
- <maxmem>1024m</maxmem>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <version>1.8</version>
- </plugin>
- <plugin>
- <artifactId>maven-site-plugin</artifactId>
- <version>3.3</version>
- </plugin>
- <plugin>
- <groupId>org.sonatype.plugins</groupId>
- <artifactId>nexus-staging-maven-plugin</artifactId>
- <version>1.6.3</version>
- <extensions>true</extensions>
- <configuration>
- <serverId>ossrh</serverId>
- <nexusUrl>https://oss.sonatype.org/</nexusUrl>
- <autoReleaseAfterClose>true</autoReleaseAfterClose>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-gpg-plugin</artifactId>
- <version>1.5</version>
- <executions>
- <execution>
- <id>sign-artifacts</id>
- <phase>verify</phase>
- <goals>
- <goal>sign</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </pluginManagement>
- </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.7.13</version>
+ </dependency>
- <profiles>
- <!-- Java 7 is no longer supported as of release 1.2.11 -->
- <profile>
- <id>jdk8</id>
- <activation>
- <jdk>1.8</jdk>
- </activation>
- <properties>
- <jdkClassifier>jdk8</jdkClassifier>
- </properties>
- </profile>
- <profile>
- <id>jdk9</id>
- <activation>
- <jdk>1.9</jdk>
- </activation>
- <properties>
- <jdkClassifier>jdk9</jdkClassifier>
- </properties>
- </profile>
- </profiles>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.12</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
- <dependencies>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>1.7.13</version>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.12</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>cobertura-maven-plugin</artifactId>
+ <version>2.6</version>
+ </plugin>
+ </plugins>
+ </reporting>
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>cobertura-maven-plugin</artifactId>
- <version>2.6</version>
- </plugin>
- </plugins>
- </reporting>
-
</project>
=====================================
src/test/java/com/conversantmedia/util/concurrent/ConcurrentQueuePerformanceTest.java → src/it/java/com/conversantmedia/util/concurrent/ConcurrentQueuePerformanceTest.java
=====================================
@@ -20,13 +20,13 @@ package com.conversantmedia.util.concurrent;
* #L%
*/
+import com.conversantmedia.util.concurrent.ConcurrentQueue;
import org.junit.Ignore;
import com.conversantmedia.util.estimation.Percentile;
/**
* Created by jcairns on 5/29/14.
*/
- at Ignore
public class ConcurrentQueuePerformanceTest {
// increase this number for a legit performance test
=====================================
src/test/java/com/conversantmedia/util/concurrent/ConcurrentStackFeedTest.java → src/it/java/com/conversantmedia/util/concurrent/ConcurrentStackFeedTest.java
=====================================
@@ -1,6 +1,7 @@
package com.conversantmedia.util.concurrent;
import com.conversantmedia.util.collection.Stack;
+import com.conversantmedia.util.concurrent.ConcurrentStack;
import org.junit.Assert;
import org.junit.Test;
=====================================
src/test/java/com/conversantmedia/util/concurrent/ConcurrentStackPerformanceTest.java → src/it/java/com/conversantmedia/util/concurrent/ConcurrentStackPerformanceTest.java
=====================================
@@ -1,6 +1,7 @@
package com.conversantmedia.util.concurrent;
import com.conversantmedia.util.collection.Stack;
+import com.conversantmedia.util.concurrent.ConcurrentStack;
import org.junit.Ignore;
import org.junit.Test;
=====================================
src/test/java/com/conversantmedia/util/concurrent/DisruptorFairSchedulingTest.java → src/it/java/com/conversantmedia/util/concurrent/DisruptorFairSchedulingTest.java
=====================================
@@ -1,5 +1,7 @@
package com.conversantmedia.util.concurrent;
+import com.conversantmedia.util.concurrent.DisruptorBlockingQueue;
+import com.conversantmedia.util.concurrent.SpinPolicy;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Ignore;
@@ -11,7 +13,6 @@ import java.util.concurrent.TimeUnit;
/**
* Created by jcairns on 2/23/16.
*/
- at Ignore // stress test
public class DisruptorFairSchedulingTest {
private static final int NTHREAD = 4*Runtime.getRuntime().availableProcessors();
=====================================
src/test/java/com/conversantmedia/util/concurrent/DisruptorOfferPollStressTest.java → src/it/java/com/conversantmedia/util/concurrent/DisruptorOfferPollStressTest.java
=====================================
@@ -1,5 +1,7 @@
package com.conversantmedia.util.concurrent;
+import com.conversantmedia.util.concurrent.DisruptorBlockingQueue;
+import com.conversantmedia.util.concurrent.SpinPolicy;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
@@ -14,7 +16,6 @@ import java.util.concurrent.TimeUnit;
/**
* Created by jcairns on 2/23/16.
*/
- at Ignore // stress test
public class DisruptorOfferPollStressTest {
private static final int QUEUE_SZ = 1024;
=====================================
src/test/java/com/conversantmedia/util/concurrent/DisruptorPerformanceTest.java → src/it/java/com/conversantmedia/util/concurrent/DisruptorPerformanceTest.java
=====================================
=====================================
src/test/java/com/conversantmedia/util/concurrent/DisruptorPerformanceTest2.java → src/it/java/com/conversantmedia/util/concurrent/DisruptorPerformanceTest2.java
=====================================
=====================================
src/test/java/com/conversantmedia/util/concurrent/DisruptorPutTakeStressTest.java → src/it/java/com/conversantmedia/util/concurrent/DisruptorPutTakeStressTest.java
=====================================
=====================================
src/test/java/com/conversantmedia/util/concurrent/DisruptorQueuePerfTest.java → src/it/java/com/conversantmedia/util/concurrent/DisruptorQueuePerfTest.java
=====================================
=====================================
src/test/java/com/conversantmedia/util/concurrent/DisruptorStressTest.java → src/it/java/com/conversantmedia/util/concurrent/DisruptorStressTest.java
=====================================
=====================================
src/test/java/com/conversantmedia/util/concurrent/MPMCConcurrentQueuePerfTest.java → src/it/java/com/conversantmedia/util/concurrent/MPMCConcurrentQueuePerfTest.java
=====================================
=====================================
src/test/java/com/conversantmedia/util/concurrent/MultithreadConcurrentQueuePerfTest.java → src/it/java/com/conversantmedia/util/concurrent/MultithreadConcurrentQueuePerfTest.java
=====================================
=====================================
src/test/java/com/conversantmedia/util/concurrent/PushPullConcurrentQueuePerfTest.java → src/it/java/com/conversantmedia/util/concurrent/PushPullConcurrentQueuePerfTest.java
=====================================
=====================================
src/main/java/com/conversantmedia/util/concurrent/AbstractWaitingCondition.java
=====================================
@@ -30,7 +30,7 @@ import static com.conversantmedia.util.concurrent.ContendedAtomicLong.CACHE_LINE
* Created by jcairns on 12/11/14.
*/
// abstract condition supporting common condition code
-abstract class AbstractWaitingCondition implements Condition {
+public abstract class AbstractWaitingCondition implements Condition {
private static final int CACHE_LINE_REFS = CACHE_LINE/Long.BYTES;
@@ -45,11 +45,12 @@ abstract class AbstractWaitingCondition implements Condition {
private final LongAdder waitCount = new LongAdder();
- @sun.misc.Contended
private final AtomicReferenceArray<Thread> waiter = new AtomicReferenceArray<>(MAX_WAITERS+2*CACHE_LINE_REFS);
- @sun.misc.Contended
+ long r1, r2, r3, r4, r5, r6, r7;
private long waitCache = 0L;
+ long c1, c2, c3, c4, c5, c6, c7, c8;
+
/**
* code below will block until test() returns false
=====================================
src/main/java/com/conversantmedia/util/concurrent/Capacity.java
=====================================
@@ -0,0 +1,58 @@
+package com.conversantmedia.util.concurrent;
+
+/*
+ * #%L
+ * Conversant Disruptor
+ * ~~
+ * Conversantmedia.com © 2018, Conversant, Inc. Conversant® is a trademark of Conversant, Inc.
+ * John Cairns © 2018
+ * ~~
+ * Licensed 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.
+ * #L%
+ */
+
+/**
+ * Created by jcairns on 7/12/2018
+ */
+final class Capacity {
+
+ public static final int MAX_POWER2 = (1<<30);
+
+ /**
+ * return the next power of two after @param capacity or
+ * capacity if it is already
+ */
+ public static int getCapacity(int capacity) {
+ int c = 1;
+ if(capacity >= MAX_POWER2) {
+ c = MAX_POWER2;
+ } else {
+ while(c < capacity) c <<= 1;
+ }
+
+ if(isPowerOf2(c)) {
+ return c;
+ } else {
+ throw new RuntimeException("Capacity is not a power of 2.");
+ }
+ }
+
+ /*
+ * define power of 2 slightly strangely to include 1,
+ * i.e. capacity 1 is allowed
+ */
+ private static final boolean isPowerOf2(final int p) {
+ // thanks mcheng for the suggestion
+ return (p & (p - 1)) == 0;
+ }
+}
=====================================
src/main/java/com/conversantmedia/util/concurrent/ConcurrentStack.java
=====================================
@@ -157,16 +157,15 @@ public final class ConcurrentStack<N> implements BlockingStack<N> {
// read the current cursor
int spin = 0;
for(;;) {
-
final long readLock = seqLock.readLock();
final int stackTop = this.stackTop.get();
- final N n = stack.get(stackTop-1);
- if(seqLock.readLockHeld(readLock)) {
- if(stackTop>0) {
- return stack.get(stackTop-1);
- } else {
- return null;
- }
+ if(stackTop > 0) {
+ final N n = stack.get(stackTop-1);
+ if(seqLock.readLockHeld(readLock)) {
+ return n;
+ } // else loop again
+ } else {
+ return null;
}
spin = Condition.progressiveYield(spin);
=====================================
src/main/java/com/conversantmedia/util/concurrent/DisruptorBlockingQueue.java
=====================================
@@ -29,11 +29,6 @@ import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeUnit;
/**
- * A fixed length blocking queue based on the principles of:
- *
- * http://disruptor.googlecode.com/files/Disruptor-1.0.pdf
- *
- * This class could be used where ArrayBlockingQueue would be otherwise.
*
* This is a lock free blocking queue that implements
* a fixed length queue backed by a ring buffer. Access to the ring buffer
=====================================
src/main/java/com/conversantmedia/util/concurrent/MPMCConcurrentQueue.java
=====================================
@@ -167,7 +167,6 @@ class MPMCConcurrentQueue<E> implements ConcurrentQueue<E> {
public long p1, p2, p3, p4, p5, p6, p7;
- @sun.misc.Contended
R entry;
public long a1, a2, a3, a4, a5, a6, a7, a8;
=====================================
src/main/java/com/conversantmedia/util/concurrent/MultithreadConcurrentQueue.java
=====================================
@@ -59,7 +59,6 @@ public class MultithreadConcurrentQueue<E> implements ConcurrentQueue<E> {
// use the value in the L1 cache rather than reading from memory when possible
long p1, p2, p3, p4, p5, p6, p7;
- @sun.misc.Contended
long tailCache = 0L;
long a1, a2, a3, a4, a5, a6, a7, a8;
@@ -67,7 +66,6 @@ public class MultithreadConcurrentQueue<E> implements ConcurrentQueue<E> {
final E[] buffer;
long r1, r2, r3, r4, r5, r6, r7;
- @sun.misc.Contended
long headCache = 0L;
long c1, c2, c3, c4, c5, c6, c7, c8;
@@ -86,9 +84,7 @@ public class MultithreadConcurrentQueue<E> implements ConcurrentQueue<E> {
*/
public MultithreadConcurrentQueue(final int capacity) {
- int c = 1;
- while(c < capacity) c <<=1;
- size = c;
+ size = Capacity.getCapacity(capacity);
mask = size - 1L;
buffer = (E[])new Object[size];
}
=====================================
src/main/java/com/conversantmedia/util/concurrent/PushPullConcurrentQueue.java
=====================================
@@ -41,24 +41,20 @@ public class PushPullConcurrentQueue<E> implements ConcurrentQueue<E> {
final LongAdder tail = new LongAdder();
long p1, p2, p3, p4, p5, p6, p7;
- @sun.misc.Contended
long tailCache = 0L;
long a1, a2, a3, a4, a5, a6, a7, a8;
final E[] buffer;
long r1, r2, r3, r4, r5, r6, r7;
- @sun.misc.Contended
long headCache = 0L;
long c1, c2, c3, c4, c5, c6, c7, c8;
final LongAdder head = new LongAdder();
- public PushPullConcurrentQueue(final int size) {
- int rs = 1;
- while(rs < size) rs <<= 1;
- this.size = rs;
- this.mask = rs-1;
+ public PushPullConcurrentQueue(final int capacity) {
+ this.size = Capacity.getCapacity(capacity);
+ this.mask = this.size-1;
buffer = (E[])new Object[this.size];
}
=====================================
src/test/java/com/conversantmedia/util/concurrent/CapacityTest.java
=====================================
@@ -0,0 +1,63 @@
+package com.conversantmedia.util.concurrent;
+
+/*
+ * #%L
+ * Conversant Disruptor
+ * ~~
+ * Conversantmedia.com © 2018, Conversant, Inc. Conversant® is a trademark of Conversant, Inc.
+ * John Cairns © 2018
+ * ~~
+ * Licensed 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.
+ * #L%
+ */
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Created by jcairns on 7/12/2018
+ */
+public class CapacityTest {
+
+ @Test
+ public void testOne() {
+
+ Assert.assertEquals(1, Capacity.getCapacity(1));
+ }
+
+ @Test
+ public void testThree() {
+
+ Assert.assertEquals(4, Capacity.getCapacity(3));
+ }
+
+ @Test
+ public void testIntMax() {
+
+ Assert.assertEquals(Capacity.MAX_POWER2, Capacity.getCapacity(Integer.MAX_VALUE));
+ }
+
+
+ @Test
+ public void testIntMax2() {
+
+ Assert.assertEquals(Capacity.MAX_POWER2, Capacity.getCapacity(Integer.MAX_VALUE/2));
+ }
+
+ @Test
+ public void testIntMax2Plus1() {
+
+ Assert.assertEquals(Capacity.MAX_POWER2, Capacity.getCapacity(Integer.MAX_VALUE/2+1));
+ }
+}
=====================================
src/test/java/com/conversantmedia/util/concurrent/ConcurrentStackTest.java
=====================================
@@ -1,5 +1,6 @@
package com.conversantmedia.util.concurrent;
+import com.conversantmedia.util.concurrent.ConcurrentStack;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
@@ -35,6 +36,25 @@ public class ConcurrentStackTest {
executor.shutdown();
}
+ @Test
+ public void peekEmptyTest() {
+
+ final ConcurrentStack<Integer> stack = new ConcurrentStack<>(10);
+
+ Assert.assertNull(stack.peek());
+ }
+
+ @Test
+ public void peekTopTest() {
+
+ final ConcurrentStack<Integer> stack = new ConcurrentStack<>(10);
+
+ stack.push(100);
+
+ Assert.assertEquals(Integer.valueOf(100), stack.peek());
+
+ }
+
@Test
public void pushPopTest() throws Exception {
final ConcurrentStack<Integer> stack = new ConcurrentStack<>(10);
=====================================
src/test/java/com/conversantmedia/util/concurrent/PushPullBlockingQueueTest.java
=====================================
@@ -619,8 +619,8 @@ public class PushPullBlockingQueueTest {
// there is a problem in the native implementation
// of null overwriting the added value on the last bucket
// when the queue was just full
- final int NRUN = 10_000;
- final BlockingQueue<Integer> dbq = new PushPullBlockingQueue<Integer>(64);
+ final int NRUN = 5_000;
+ final BlockingQueue<Integer> dbq = new PushPullBlockingQueue<Integer>(5000);
final Thread t = new Thread(new Runnable() {
@Override
public void run() {
View it on GitLab: https://salsa.debian.org/java-team/conversant-disruptor/compare/f7ad0e92d0b6e533ef4808bbd57ad6c1405c5c6a...1f6b014e6064b259b656442a38425256cae77dd6
--
View it on GitLab: https://salsa.debian.org/java-team/conversant-disruptor/compare/f7ad0e92d0b6e533ef4808bbd57ad6c1405c5c6a...1f6b014e6064b259b656442a38425256cae77dd6
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20190913/f6e7983b/attachment.html>
More information about the pkg-java-commits
mailing list