Skip to content

Commit

Permalink
🐳 21.16
Browse files Browse the repository at this point in the history
  • Loading branch information
iohao committed Sep 9, 2024
1 parent 46c967e commit b977b61
Show file tree
Hide file tree
Showing 21 changed files with 62 additions and 22 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ ioGame 是轻量级的网络编程框架,**不依赖任何第三方**中间件
<dependency>
<groupId>com.iohao.game</groupId>
<artifactId>run-one-netty</artifactId>
<version>21.15</version>
<version>21.16</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion common/common-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>ioGame</artifactId>
<groupId>com.iohao.game</groupId>
<version>21.15</version>
<version>21.16</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public final class IoGameVersion {
public static final String VERSION;

static {
String internalVersion = "<version>21.15</version>";
String internalVersion = "<version>21.16</version>";

VERSION = internalVersion
.replace("<version>", "")
Expand Down
2 changes: 1 addition & 1 deletion common/common-kit/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>ioGame</artifactId>
<groupId>com.iohao.game</groupId>
<version>21.15</version>
<version>21.16</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion common/common-micro-kit/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.iohao.game</groupId>
<artifactId>ioGame</artifactId>
<version>21.15</version>
<version>21.16</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,4 +270,45 @@ public void onUpdate() {
log.info("向【{}】开炮,造成 {} 伤害", targetEntity, value);
}
}

@Test
public void example() {
long timeMillis = System.currentTimeMillis();

DelayTask delayTask = DelayTaskKit.of(() -> {
long value = System.currentTimeMillis() - timeMillis;
log.info("1 - 最终 {} ms 后,执行延时任务", value);
})
.plusTime(Duration.ofSeconds(1)) // 增加 1 秒的延时
// 启动任务
.task();

delayTask.plusTimeMillis(500); // 增加 0.5 秒的延时
delayTask.minusTimeMillis(500);// 减少 0.5 秒的延时时间

// 因为 taskId 相同,所以会覆盖之前的延时任务
String taskId = delayTask.getTaskId();
delayTask = DelayTaskKit.of(taskId, () -> {
long value = System.currentTimeMillis() - timeMillis;
log.info("2 - 最终 {} ms 后,执行延时任务", value);
})
.plusTime(Duration.ofSeconds(1)) // 增加 1 秒的延时
// 启动任务
.task();

// 取消延时任务,下面两个方法是等价的
delayTask.cancel();
DelayTaskKit.cancel(taskId);

// 可以通过 taskId 查找该延时任务
Optional<DelayTask> optionalDelayTask = DelayTaskKit.optional(taskId);
if (optionalDelayTask.isPresent()) {
var delayTaskObj = optionalDelayTask.get();
}

// 通过 taskId 查找延时任务,存在则执行给定逻辑
DelayTaskKit.ifPresent(taskId, task -> {
task.plusTimeMillis(500); // 增加 0.5 秒的延时时间
});
}
}
2 changes: 1 addition & 1 deletion common/common-validation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>ioGame</artifactId>
<groupId>com.iohao.game</groupId>
<version>21.15</version>
<version>21.16</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion external/external-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.iohao.game</groupId>
<artifactId>ioGame</artifactId>
<version>21.15</version>
<version>21.16</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
package com.iohao.game.external.core.session;

import com.iohao.game.common.kit.CollKit;
import com.iohao.game.common.kit.attr.AttrOptionDynamic;
import com.iohao.game.external.core.hook.UserHook;

Expand Down Expand Up @@ -101,7 +100,7 @@ default void ifPresent(Collection<Long> userIdList, Consumer<Session> consumer)
boolean existUserSession(long userId);

/**
* 设置 channel 的 userId
* 设置 channel 的 userId,表示已经身份验证了(即登录过了)。
*
* @param userChannelId userChannelId
* @param userId userId
Expand Down
2 changes: 1 addition & 1 deletion external/external-netty/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.iohao.game</groupId>
<artifactId>ioGame</artifactId>
<version>21.15</version>
<version>21.16</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion net-bolt/bolt-broker-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>ioGame</artifactId>
<groupId>com.iohao.game</groupId>
<version>21.15</version>
<version>21.16</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion net-bolt/bolt-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>ioGame</artifactId>
<groupId>com.iohao.game</groupId>
<version>21.15</version>
<version>21.16</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion net-bolt/bolt-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>ioGame</artifactId>
<groupId>com.iohao.game</groupId>
<version>21.15</version>
<version>21.16</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.iohao.game</groupId>
<artifactId>ioGame</artifactId>
<version>21.15</version>
<version>21.16</version>
<name>ioGame</name>
<description>
生产资料公有制。
Expand Down Expand Up @@ -53,7 +53,7 @@
<encoding>UTF-8</encoding>

<!-- 网络库 : https://mvnrepository.com/artifact/io.netty/netty-all -->
<netty.version>4.1.112.Final</netty.version>
<netty.version>4.1.113.Final</netty.version>
<!-- bolt https://mvnrepository.com/artifact/com.alipay.sofa/bolt -->
<bolt.version>1.6.6</bolt.version>
<!-- hessian 格式化 https://mvnrepository.com/artifact/com.caucho/hessian -->
Expand Down
2 changes: 1 addition & 1 deletion run-one/run-one-netty/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.iohao.game</groupId>
<artifactId>ioGame</artifactId>
<version>21.15</version>
<version>21.16</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion widget/light-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.iohao.game</groupId>
<artifactId>ioGame</artifactId>
<version>21.15</version>
<version>21.16</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion widget/light-domain-event/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>ioGame</artifactId>
<groupId>com.iohao.game</groupId>
<version>21.15</version>
<version>21.16</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion widget/light-game-room/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>ioGame</artifactId>
<groupId>com.iohao.game</groupId>
<version>21.15</version>
<version>21.16</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion widget/light-jprotobuf/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>ioGame</artifactId>
<groupId>com.iohao.game</groupId>
<version>21.15</version>
<version>21.16</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion widget/light-profile/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>ioGame</artifactId>
<groupId>com.iohao.game</groupId>
<version>21.15</version>
<version>21.16</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion widget/other-tool/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.iohao.game</groupId>
<artifactId>ioGame</artifactId>
<version>21.15</version>
<version>21.16</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down

0 comments on commit b977b61

Please sign in to comment.