Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

version 1.2.9: add USER_EXITED_APP EVENT #131

Merged
merged 1 commit into from
Nov 22, 2024
Merged
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
2 changes: 1 addition & 1 deletion ezyfox-server-boot/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.tvd12</groupId>
<artifactId>ezyfox-server</artifactId>
<version>1.2.8.2</version>
<version>1.2.9</version>
</parent>
<artifactId>ezyfox-server-boot</artifactId>

Expand Down
2 changes: 1 addition & 1 deletion ezyfox-server-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.tvd12</groupId>
<artifactId>ezyfox-server</artifactId>
<version>1.2.8.2</version>
<version>1.2.9</version>
</parent>
<artifactId>ezyfox-server-core</artifactId>
<name>ezyfox-server-core</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public final class EzyEventNames {
public static final String USER_LOGIN = "USER_LOGIN";
public static final String USER_ACCESS_APP = "USER_ACCESS_APP";
public static final String USER_ACCESSED_APP = "USER_ACCESSED_APP";
public static final String USER_EXITED_APP = "USER_EXITED_APP";
public static final String USER_ADDED = "USER_ADDED";
public static final String USER_REMOVED = "USER_REMOVED";
public static final String SESSION_REMOVED = "SESSION_REMOVED";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.tvd12.ezyfox.constant.EzyConstant;
import lombok.Getter;

@Getter
public enum EzyEventType implements EzyConstant {

SERVER_INITIALIZING(0),
Expand All @@ -13,10 +14,10 @@ public enum EzyEventType implements EzyConstant {
USER_ADDED(26),
USER_REMOVED(27),
USER_ACCESSED_APP(28),
USER_EXITED_APP(29),
SESSION_REMOVED(35),
STREAMING(36);

@Getter
private final int id;

EzyEventType(int id) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
package com.tvd12.ezyfoxserver.controller;

import com.tvd12.ezyfoxserver.EzyApplication;
import com.tvd12.ezyfoxserver.constant.EzyEventType;
import com.tvd12.ezyfoxserver.constant.EzyUserRemoveReason;
import com.tvd12.ezyfoxserver.context.EzyAppContext;
import com.tvd12.ezyfoxserver.context.EzyServerContext;
import com.tvd12.ezyfoxserver.entity.EzyUser;
import com.tvd12.ezyfoxserver.event.EzySimpleUserExitedAppEvent;
import com.tvd12.ezyfoxserver.event.EzyUserExitedAppEvent;
import com.tvd12.ezyfoxserver.request.EzyExitAppRequest;
import com.tvd12.ezyfoxserver.wrapper.EzyAppUserManager;

Expand All @@ -17,6 +21,9 @@ public void handle(EzyServerContext ctx, EzyExitAppRequest request) {
EzyAppContext appContext = ctx.getAppContext(appId);
EzyApplication app = appContext.getApp();
EzyAppUserManager userManager = app.getUserManager();
userManager.removeUser(request.getUser(), EzyUserRemoveReason.EXIT_APP);
EzyUser user = request.getUser();
userManager.removeUser(user, EzyUserRemoveReason.EXIT_APP);
EzyUserExitedAppEvent event = new EzySimpleUserExitedAppEvent(user);
appContext.handleEvent(EzyEventType.USER_EXITED_APP, event);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class EzySimpleUser
@Setter(AccessLevel.NONE)
protected Map<Long, EzySession> sessionMap = new ConcurrentHashMap<>();

private static final transient AtomicLong COUNTER = new AtomicLong(0);
private static final AtomicLong COUNTER = new AtomicLong(0);

@Override
public void addSession(EzySession session) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.tvd12.ezyfoxserver.event;

import com.tvd12.ezyfoxserver.entity.EzyUser;
import lombok.Getter;

@Getter
public class EzySimpleUserExitedAppEvent
extends EzySimpleUserEvent
implements EzyUserExitedAppEvent {

public EzySimpleUserExitedAppEvent(EzyUser user) {
super(user);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.tvd12.ezyfoxserver.event;

public interface EzyUserExitedAppEvent extends EzyUserEvent {}
2 changes: 1 addition & 1 deletion ezyfox-server-embedded/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.tvd12</groupId>
<artifactId>ezyfox-server</artifactId>
<version>1.2.8.2</version>
<version>1.2.9</version>
</parent>
<artifactId>ezyfox-server-embedded</artifactId>

Expand Down
4 changes: 2 additions & 2 deletions ezyfox-server-nio/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
<parent>
<groupId>com.tvd12</groupId>
<artifactId>ezyfox-server</artifactId>
<version>1.2.8.2</version>
<version>1.2.9</version>
</parent>
<artifactId>ezyfox-server-nio</artifactId>

<name>ezyfox-server-nio</name>
<url>https://youngmonkeys.org/project/ezyfox-sever/</url>

<properties>
<jetty.version>9.4.50.v20221201</jetty.version>
<jetty.version>9.4.56.v20240826</jetty.version>
</properties>

<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion ezyfox-server-niorunner/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.tvd12</groupId>
<artifactId>ezyfox-server</artifactId>
<version>1.2.8.2</version>
<version>1.2.9</version>
</parent>
<artifactId>ezyfox-server-niorunner</artifactId>

Expand Down
2 changes: 1 addition & 1 deletion ezyfox-server-support/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.tvd12</groupId>
<artifactId>ezyfox-server</artifactId>
<version>1.2.8.2</version>
<version>1.2.9</version>
</parent>
<artifactId>ezyfox-server-support</artifactId>
<name>ezyfox-server-support</name>
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<version>1.0.6</version>
</parent>
<artifactId>ezyfox-server</artifactId>
<version>1.2.8.2</version>
<version>1.2.9</version>
<packaging>pom</packaging>

<name>ezyfox-server</name>
Expand Down Expand Up @@ -57,7 +57,7 @@
</developers>

<properties>
<ezy.version>1.2.8</ezy.version>
<ezy.version>1.2.9</ezy.version>
<ezy.core.version>2.1.7</ezy.core.version>
</properties>

Expand Down
Loading