Skip to content

Commit fd8d24f

Browse files
committed
[broker-25] small refactoring
1 parent d2056cb commit fd8d24f

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

src/main/java/com/ss/mqtt/broker/MqttBrokerApplication.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22

33
import com.ss.mqtt.broker.config.MqttBrokerConfig;
44
import lombok.RequiredArgsConstructor;
5-
import lombok.extern.log4j.Log4j2;
65
import org.jetbrains.annotations.NotNull;
76
import org.springframework.boot.SpringApplication;
87
import org.springframework.context.annotation.Configuration;
98
import org.springframework.context.annotation.Import;
109

11-
@Log4j2
1210
@Configuration
1311
@RequiredArgsConstructor
1412
@Import(MqttBrokerConfig.class)

src/main/java/com/ss/mqtt/broker/handler/client/AbstractMqttClientReleaseHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public abstract class AbstractMqttClientReleaseHandler<T extends AbstractMqttCli
2525
var clientId = client.getClientId();
2626
//noinspection unchecked
2727
return releaseImpl((T) client)
28-
.doOnNext(aVoid -> log.info("Client {} was released.", clientId));
28+
.doOnNext(aVoid -> log.info("Client {} was released", clientId));
2929
}
3030

3131
protected @NotNull Mono<?> releaseImpl(@NotNull T client) {
@@ -34,7 +34,7 @@ public abstract class AbstractMqttClientReleaseHandler<T extends AbstractMqttCli
3434
client.setClientId(StringUtils.EMPTY);
3535

3636
if (StringUtils.isEmpty(clientId)) {
37-
log.warn("This client {} is already released.", client);
37+
log.warn("This client {} is already released", client);
3838
return Mono.empty();
3939
}
4040

src/main/java/com/ss/mqtt/broker/model/topic/AbstractTopic.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ int levelsCount() {
5353
}
5454

5555
@Override
56-
public String toString() {
56+
public @NotNull String toString() {
5757
return rawTopic;
5858
}
5959
}

src/main/java/com/ss/mqtt/broker/service/impl/InMemoryMqttSessionService.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public InMemoryMqttSessionService(int cleanInterval) {
4141
var session = storedSession.getInWriteLock(clientId, ObjectDictionary::remove);
4242

4343
if (session != null) {
44+
session.onRestored();
4445
log.debug("Restored session for client {}", clientId);
4546
} else {
4647
log.debug("No stored session for client {}", clientId);
@@ -72,6 +73,7 @@ public InMemoryMqttSessionService(int cleanInterval) {
7273

7374
var unsafe = (UnsafeMqttSession) session;
7475
unsafe.setExpirationTime(System.currentTimeMillis() + (expiryInterval * 1000));
76+
unsafe.onPersisted();
7577

7678
storedSession.runInWriteLock(clientId, unsafe, ObjectDictionary::put);
7779

0 commit comments

Comments
 (0)