Skip to content

custom event store with memory store#94

Merged
NeatGuyCoding merged 2 commits intomainfrom
memory-store-custom-event-store
Dec 21, 2025
Merged

custom event store with memory store#94
NeatGuyCoding merged 2 commits intomainfrom
memory-store-custom-event-store

Conversation

@sanjomo
Copy link
Member

@sanjomo sanjomo commented Dec 20, 2025

Description

Store - stores connection related details
Event store - events notification to other nodes

this option enables the users to use memory store and any other event store (redis, hazelcast, etc)

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code refactoring
  • Test improvements
  • Build/tooling changes

Related Issue

Closes #(issue number)

Changes Made

Testing

  • All existing tests pass
  • New tests added for new functionality
  • Tests pass locally with mvn test
  • Integration tests pass (if applicable)

Checklist

  • Code follows project coding standards
  • Self-review completed
  • Code is commented where necessary
  • Documentation updated (if needed)
  • Commit messages follow conventional format
  • No merge conflicts
  • All CI checks pass

Additional Notes

Any additional information, screenshots, or context that reviewers should know.

Summary by CodeRabbit

  • Refactor
    • Enhanced event store component architecture to support flexible configuration and dependency injection, improving system modularity and maintainability.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 20, 2025

Walkthrough

MemoryStoreFactory now holds a generic EventStore instead of a concrete MemoryEventStore. Two constructors were added: a default that instantiates MemoryEventStore, and one that accepts an external EventStore (null-checked). eventStore() returns the EventStore field.

Changes

Cohort / File(s) Change Summary
Dependency injection / Store factory
netty-socketio-core/src/main/java/com/socketio4j/socketio/store/memory/MemoryStoreFactory.java
Replaced concrete MemoryEventStore field with a generic EventStore field; added default constructor initializing eventStore to new MemoryEventStore(); added constructor accepting external EventStore (with Objects.requireNonNull); updated eventStore() to return the generic EventStore.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Areas to focus:
    • Verify all call sites accept/handle EventStore (no reliance on MemoryEventStore-specific API).
    • Confirm default constructor preserves existing behavior.
    • Validate null-check and assignment in the injected constructor.

Suggested reviewers

  • NeatGuyCoding

Poem

🐰 I swapped the memory box for a friendly gate,
Two doors now open — default or passed-in fate.
Interfaces hop, constructors hum a tune,
A rabbit nods beneath the cookie-moon. ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'custom event store with memory store' is directly related to the main change: introducing support for custom event stores with memory store implementation.
Description check ✅ Passed The description covers the feature purpose and testing status but lacks specific details in the 'Changes Made' section and references an unresolved placeholder for the related issue.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch memory-store-custom-event-store

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b8371ee and c263584.

📒 Files selected for processing (1)
  • netty-socketio-core/src/main/java/com/socketio4j/socketio/store/memory/MemoryStoreFactory.java (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • netty-socketio-core/src/main/java/com/socketio4j/socketio/store/memory/MemoryStoreFactory.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: build (17) / build
  • GitHub Check: build (21) / build
  • GitHub Check: build (25) / build
  • GitHub Check: qodana
  • GitHub Check: Analyze (java-kotlin)
  • GitHub Check: Analyze (java-kotlin)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sanjomo sanjomo self-assigned this Dec 20, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
netty-socketio-core/src/main/java/com/socketio4j/socketio/store/memory/MemoryStoreFactory.java (1)

35-37: Consider adding JavaDoc to document the custom EventStore constructor.

The new constructor enables dependency injection of custom EventStore implementations, which is a significant API enhancement. Adding JavaDoc would help users understand when and why to use this constructor versus the default one.

💡 Example JavaDoc
+/**
+ * Creates a MemoryStoreFactory with a custom EventStore implementation.
+ * This constructor allows dependency injection of a custom event store while
+ * maintaining the in-memory session store behavior.
+ *
+ * @param eventStore the EventStore implementation to use (must not be null)
+ */
 public MemoryStoreFactory(EventStore eventStore) {
     this.eventStore = eventStore;
 }
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bde42ca and b8371ee.

📒 Files selected for processing (1)
  • netty-socketio-core/src/main/java/com/socketio4j/socketio/store/memory/MemoryStoreFactory.java (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: build (21) / build
  • GitHub Check: build (25) / build
  • GitHub Check: build (17) / build
  • GitHub Check: qodana
  • GitHub Check: Analyze (java-kotlin)
  • GitHub Check: Analyze (java-kotlin)
🔇 Additional comments (3)
netty-socketio-core/src/main/java/com/socketio4j/socketio/store/memory/MemoryStoreFactory.java (3)

29-29: LGTM! Good use of interface type for dependency injection.

The field declaration correctly uses the EventStore interface instead of the concrete implementation, enabling flexibility while the final modifier ensures immutability.


31-33: LGTM! Backward compatibility maintained.

The default constructor properly initializes the EventStore with a MemoryEventStore instance, ensuring existing code continues to work without modification.


44-45: LGTM! Method correctly returns the injected EventStore.

The method now returns the generic EventStore interface, which correctly supports both the default MemoryEventStore and any custom implementations injected via the constructor.

Comment on lines +31 to +37
public MemoryStoreFactory() {
this.eventStore = new MemoryEventStore();
}

public MemoryStoreFactory(EventStore eventStore) {
this.eventStore = eventStore;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Find test files referencing MemoryStoreFactory
find . -type f -name "*Test*.java" -o -name "*Tests*.java" | head -20

Repository: socketio4j/netty-socketio

Length of output: 2002


🏁 Script executed:

#!/bin/bash
# Search for references to MemoryStoreFactory in test files
rg -t java "MemoryStoreFactory" --glob="*Test*.java" -l

Repository: socketio4j/netty-socketio

Length of output: 160


🏁 Script executed:

#!/bin/bash
# Check if test files exist and show their content
find . -path "*test*" -name "*MemoryStore*" -type f 2>/dev/null

Repository: socketio4j/netty-socketio

Length of output: 249


🏁 Script executed:

#!/bin/bash
# Read the MemoryStoreFactoryTest.java file to check test coverage
cat -n ./netty-socketio-core/src/test/java/com/socketio4j/socketio/store/MemoryStoreFactoryTest.java

Repository: socketio4j/netty-socketio

Length of output: 6951


Add tests for the new parameterized constructor.

The test file covers the default constructor but lacks tests for the new dependency injection constructor. Add tests that:

  • Create MemoryStoreFactory with a custom EventStore implementation
  • Verify the custom EventStore is returned by eventStore()
  • Test null validation for the custom EventStore parameter (if null checks are implemented)
🤖 Prompt for AI Agents
In
netty-socketio-core/src/main/java/com/socketio4j/socketio/store/memory/MemoryStoreFactory.java
around lines 31 to 37, add unit tests that exercise the new parameterized
constructor: create a test that instantiates MemoryStoreFactory with a custom
EventStore implementation (e.g., an anonymous class or lightweight stub), assert
that factory.eventStore() returns the exact instance passed in, and add a test
for the null case (if the constructor should reject null) that verifies a
NullPointerException or IllegalArgumentException is thrown; if the constructor
currently allows null, instead assert behavior (e.g., returns null or uses
default) and update tests accordingly.

@github-actions
Copy link

github-actions bot commented Dec 20, 2025

Qodana for JVM

61 new problems were found

Inspection name Severity Problems
Vulnerable declared dependency 🔶 Warning 8
Pointless arithmetic expression 🔶 Warning 7
Comparison of 'short' and 'char' values 🔶 Warning 2
Result of method call ignored 🔶 Warning 2
Busy wait 🔶 Warning 1
Injection point with ambiguous dependencies 🔶 Warning 1
Constant values 🔶 Warning 1
Number of placeholders does not match number of arguments in logging call 🔶 Warning 1
Unnecessary 'null' check before method call 🔶 Warning 1
Wrapper type may be primitive 🔶 Warning 1
Non-distinguishable logging calls ◽️ Notice 27
Vulnerable declared dependency ◽️ Notice 9

☁️ View the detailed Qodana report

Detected 123 dependencies

Third-party software list

This page lists the third-party software dependencies used in project

Dependency Version Licenses
aesh 2.8.2 Apache-2.0
annotations 26.0.2-1 Apache-2.0
arc-processor 3.30.3 Apache-2.0
arc 3.30.3 Apache-2.0
asm-analysis 9.9 BSD-3-Clause
asm-commons 9.9 BSD-3-Clause
asm-tree 9.9 BSD-3-Clause
asm-util 9.9 BSD-3-Clause
asm 9.9 BSD-3-Clause
byte-buddy 1.17.7 Apache-2.0
cache-api 1.1.1 Apache-2.0
commons-codec 1.20.0 Apache-2.0
commons-compress 1.28.0 Apache-2.0
commons-io 2.21.0 Apache-2.0
commons-logging-jboss-logging 1.0.0.final Apache-2.0
commons-logging 1.3.5 Apache-2.0
crac 1.5.0 BSD-2-Clause
gizmo 1.9.0 Apache-2.0
gizmo2 2.0.0.beta10 Apache-2.0
hazelcast 5.2.5 MIT
jackson-annotations 2.20 Apache-2.0
jackson-core 2.20.1 Apache-2.0
jackson-databind 2.20.1 Apache-2.0
jackson-dataformat-yaml 2.20.0 AML
jackson-datatype-jsr310 2.20.0 Apache-2.0
jakarta.annotation-api 2.1.1 Classpath-exception-2.0
EPL-2.0
GPL-2.0-only
jakarta.annotation-api 3.0.0 Classpath-exception-2.0
EPL-2.0
GPL-2.0-only
jakarta.el-api 6.0.1 Classpath-exception-2.0
EPL-2.0
GPL-2.0-only
jakarta.enterprise.cdi-api 4.1.0 Apache-2.0
jakarta.enterprise.lang-model 4.1.0 Apache-2.0
jakarta.inject-api 2.0.1 Apache-2.0
jakarta.interceptor-api 2.2.0 Classpath-exception-2.0
EPL-2.0
GPL-2.0-only
jakarta.json-api 2.1.3 Classpath-exception-2.0
EPL-2.0
GPL-2.0-only
jakarta.transaction-api 2.0.1 Classpath-exception-2.0
EPL-2.0
GPL-2.0-only
jandex-gizmo2 3.5.2 Apache-2.0
jandex 3.5.2 Apache-2.0
jansi 2.4.0 Apache-2.0
jboss-logging 3.6.1.final Apache-2.0
jboss-logmanager 3.1.2.final Apache-2.0
jboss-threads 3.9.1 Apache-2.0
jctools-core 4.0.5 Apache-2.0
jdk-classfile-backport 25.1 GPL-2.0-only
jodd-util 6.3.0 BSD-2-Clause
jspecify 1.0.0 Apache-2.0
jul-to-slf4j 2.0.17 MIT
kryo 5.6.2 BSD-3-Clause
log4j-api 2.25.2 Apache-2.0
log4j-to-slf4j 2.25.2 Apache-2.0
micrometer-commons 1.16.0 Apache-2.0
micrometer-observation 1.16.0 Apache-2.0
micronaut-aop 4.10.2 Apache-2.0
micronaut-context-propagation 4.10.2 Apache-2.0
micronaut-context 4.10.2 Apache-2.0
micronaut-core-reactive 4.10.2 Apache-2.0
micronaut-core 4.10.2 Apache-2.0
micronaut-discovery-core 4.10.2 Apache-2.0
micronaut-http-server 4.10.2 Apache-2.0
micronaut-http 4.10.2 Apache-2.0
micronaut-inject 4.10.2 Apache-2.0
micronaut-retry 4.10.2 Apache-2.0
micronaut-router 4.10.2 Apache-2.0
micronaut-runtime 4.10.2 Apache-2.0
microprofile-config-api 3.1 Apache-2.0
microprofile-context-propagation-api 1.3 Apache-2.0
minlog 1.3.1 BSD-3-Clause
mutiny 3.0.3 Apache-2.0
nativeimage 23.1.2 UPL-1.0
netty-common 4.2.9.final Apache-2.0
parsson 1.1.7 Classpath-exception-2.0
EPL-2.0
GPL-2.0-only
quarkus-arc-deployment 3.30.3 Apache-2.0
quarkus-arc-dev 3.30.3 Apache-2.0
quarkus-arc 3.30.3 Apache-2.0
quarkus-bootstrap-app-model 3.30.3 Apache-2.0
quarkus-bootstrap-core 3.30.3 Apache-2.0
quarkus-bootstrap-runner 3.30.3 Apache-2.0
quarkus-builder 3.30.3 Apache-2.0
quarkus-class-change-agent 3.30.3 Apache-2.0
quarkus-classloader-commons 3.30.3 Apache-2.0
quarkus-core-deployment 3.30.3 Apache-2.0
quarkus-core 3.30.3 Apache-2.0
quarkus-development-mode-spi 3.30.3 Apache-2.0
quarkus-devui-deployment-spi 3.30.3 Apache-2.0
quarkus-fs-util 1.2.0 Apache-2.0
quarkus-hibernate-validator-spi 3.30.3 Apache-2.0
quarkus-ide-launcher 3.30.3 Apache-2.0
quarkus-smallrye-context-propagation-spi 3.30.3 Apache-2.0
reactive-streams 1.0.4 MIT-0
reactor-core 3.6.2 Apache-2.0
reactor-core 3.7.9 Apache-2.0
readline 2.6 Apache-2.0
redisson 3.52.0 Apache-2.0
reflectasm 1.11.9 BSD-3-Clause
rxjava 3.1.8 Apache-2.0
slf4j-api 2.0.17 MIT
slf4j-jboss-logmanager 2.0.2.final Apache-2.0
smallrye-common-annotation 2.14.0 Apache-2.0
smallrye-common-classloader 2.14.0 Apache-2.0
smallrye-common-constraint 2.14.0 Apache-2.0
smallrye-common-cpu 2.14.0 Apache-2.0
smallrye-common-expression 2.14.0 Apache-2.0
smallrye-common-function 2.14.0 Apache-2.0
smallrye-common-io 2.14.0 Apache-2.0
smallrye-common-net 2.14.0 Apache-2.0
smallrye-common-os 2.14.0 Apache-2.0
smallrye-common-process 2.14.0 Apache-2.0
smallrye-common-ref 2.14.0 Apache-2.0
smallrye-common-resource 2.14.0 Apache-2.0
smallrye-config-common 3.14.1 Apache-2.0
smallrye-config-core 3.14.1 Apache-2.0
smallrye-config 3.14.1 Apache-2.0
snakeyaml 2.4 Apache-2.0
snakeyaml 2.5 Apache-2.0
spring-aop 7.0.1 Apache-2.0
spring-beans 7.0.1 Apache-2.0
spring-boot-autoconfigure 4.0.0 Apache-2.0
spring-boot-starter-logging 4.0.0 Apache-2.0
spring-boot-starter 4.0.0 Apache-2.0
spring-boot 4.0.0 Apache-2.0
spring-context 7.0.1 Apache-2.0
spring-core 7.0.1 Apache-2.0
spring-expression 7.0.1 Apache-2.0
wildfly-common 2.0.1 Apache-2.0
word 23.1.2 UPL-1.0
Contact Qodana team

Contact us at qodana-support@jetbrains.com

@NeatGuyCoding NeatGuyCoding merged commit a90704d into main Dec 21, 2025
10 checks passed
@NeatGuyCoding NeatGuyCoding deleted the memory-store-custom-event-store branch December 21, 2025 06:51
@coderabbitai coderabbitai bot mentioned this pull request Jan 1, 2026
18 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants