Skip to content
Merged

Dev #35

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ xtool 是一个小小的 Java 工具集,遵循简单、可靠的原则,不
<dependency>
<groupId>com.igeeksky.xtool</groupId>
<artifactId>xtool</artifactId>
<version>1.1.3</version>
<version>1.1.4</version>
</dependency>
```

### 2.2.Gradle

```groovy
implementation group: 'com.igeeksky.xtool', name: 'xtool', version: '1.1.3'
implementation group: 'com.igeeksky.xtool', name: 'xtool', version: '1.1.4'
```

### 2.3.编译安装
Expand Down Expand Up @@ -80,6 +80,10 @@ mvn clean install

## 4. 更新日志

### 1.1.3

1. add AsyncCloseable API

### 1.1.2

1. add Shutdown API
Expand Down
6 changes: 3 additions & 3 deletions docs/Reference.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## xtool 参考文档

Author: [Patrick.Lau](mailto:patricklauxx@gmail.com) Version: 1.1.3
Author: [Patrick.Lau](mailto:patricklauxx@gmail.com) Version: 1.1.4

[![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html) [![Release](https://img.shields.io/github/v/release/patricklaux/xtool)](https://github.com/patricklaux/xtool/releases) [![Maven Central](https://img.shields.io/maven-central/v/com.igeeksky.xtool/xtool.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com.igeeksky.xtool%22%20AND%20a:%22xtool%22) [![codecov](https://codecov.io/gh/patricklaux/xtool/branch/main/graph/badge.svg?token=VJ87A1IAVH)](https://codecov.io/gh/patricklaux/xtool) [![Last commit](https://img.shields.io/github/last-commit/patricklaux/xtool)](https://github.com/patricklaux/xtool/commits) [![Join the chat at https://gitter.im/igeeksky/xtool](https://badges.gitter.im/igeeksky/xtool.svg)](https://gitter.im/igeeksky/xtool?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

Expand All @@ -26,14 +26,14 @@ xtool 是一个小小的 Java 工具集,遵循简单、可靠的原则,不
<dependency>
<groupId>com.igeeksky.xtool</groupId>
<artifactId>xtool</artifactId>
<version>1.1.3</version>
<version>1.1.4</version>
</dependency>
```

#### 1.2.2.Gradle

```groovy
implementation group: 'com.igeeksky.xtool', name: 'xtool', version: '1.1.3'
implementation group: 'com.igeeksky.xtool', name: 'xtool', version: '1.1.4'
```

#### 1.2.3.编译安装
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.igeeksky.xtool</groupId>
<artifactId>xtool</artifactId>
<version>1.1.3</version>
<version>1.1.4</version>
<name>xtool</name>
<description>xtool is a very small set of Java tools.</description>
<url>https://github.com/patricklaux/xtool</url>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ void test_TwoOffer_TwoConsumer_Concurrently() throws InterruptedException {

@Test
void test_TwoOffer_OnePoll_Concurrently() throws InterruptedException {
RingBuffer<String> buffer = new RingBuffer<>(2048);
RingBuffer<String> buffer = new RingBuffer<>(1000);
StringConsumer consumer = new StringConsumer();
CountDownLatch latch = new CountDownLatch(2);

Expand All @@ -402,7 +402,7 @@ void test_TwoOffer_OnePoll_Concurrently() throws InterruptedException {
thread1.start();
thread2.start();

latch.await(2000, TimeUnit.MILLISECONDS);
LockSupport.parkNanos(10);

for (int i = 0; i < 2001; i++) {
String polled = buffer.poll();
Expand All @@ -413,6 +413,21 @@ void test_TwoOffer_OnePoll_Concurrently() throws InterruptedException {
assertEquals(consumer.getCount(), buffer.reads());
}

System.out.println("buffer.reads()1:" + buffer.reads());

boolean ignored = latch.await(100, TimeUnit.MILLISECONDS);

for (int i = 0; i < 2001; i++) {
String polled = buffer.poll();
if (polled != null) {
consumer.accept(polled);
continue;
}
assertEquals(consumer.getCount(), buffer.reads());
}

System.out.println("buffer.reads()2:" + buffer.reads());

Set<String> values = consumer.getValues();
for (int i = 0; i < 2000; i++) {
String element = "element" + i;
Expand Down