jhipster / generator-jhipster

JHipster is a development platform to quickly generate, develop, & deploy modern web applications & microservice architectures.
https://www.jhipster.tech
Apache License 2.0
21.54k stars 4.02k forks source link

CacheConfiguration.java upgrades for Infinispan library upgrades #21230

Closed anothergoodguy closed 1 year ago

anothergoodguy commented 1 year ago

Dear Team, Greetings!

I tried to experiment with the main branch of Jhipster Generator. We use Infinispan cache in our apps and here is some observation I'd like to share. When we use infinispan, the generated CacheConfiguration.java needs below changes, due to the upgrades on infinispan's library changes:

Method: private JChannel getTransportChannel()

Old Snippet - 1:

        tcp.setThreadPoolMinThreads(2);
        tcp.setThreadPoolMaxThreads(30);
        tcp.setThreadPoolKeepAliveTime(60000);

Old Snippet - 2:

nakack.setUseMcastXmit(false);

New Snippet - 1:

        tcp.getThreadPool().setMinThreads(2);
        tcp.getThreadPool().setMaxThreads(30);
        tcp.getThreadPool().setKeepAliveTime(60000);

New Snippet - 2:

nakack.useMcastXmit(false); Also, Please be informed, I have just compiled and ran the test app with the changes and have not worked on any performance benchmarking...

Creating a new ticket as advised in the original post...

Thank you for such a wonderful tool...

Originally posted by @anothergoodguy in https://github.com/jhipster/generator-jhipster/issues/20849#issuecomment-1445044907

anothergoodguy commented 1 year ago

one more observation:

Application wont start as it as SpringEmbeddedCacheManager / EmbeddedCacheManager is not getting initialized at startup:

2023-02-28T19:55:06.929+05:30 ERROR 42645 --- [  restartedMain] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

Parameter 0 of constructor in com.sample.shop.config.CacheFactoryConfiguration required a bean of type 'org.infinispan.manager.EmbeddedCacheManager' that could not be found.
Consider defining a bean of type 'org.infinispan.manager.EmbeddedCacheManager' in your configuration.

I am not sure if it's a bug in Infinispan itself, but I tried with adding below snippet to CacheConfiguration.java. Then it fails at the time of login as com.sample.shop.repository.UserRepository.USERS_BY_LOGIN_CACHE & com.sample.shop.repository.UserRepository.USERS_BY_EMAIL_CACHE are not getting initialized.

attached are my .yo-rc.json & store.jh (Used to generate the sample app) for your reference. please let me know if you want me to place the code also.

Action: store.jh.txt

yo-rc.json.txt

mshima commented 1 year ago

There are some progress at https://github.com/jhipster/generator-jhipster/pull/20398. But spring-boot 3 support will probably be supported by inifinispan 15.

anothergoodguy commented 1 year ago

@mshima thank you for the quick response. I'll keep watching this issue and the PR and will share my observations when we are ready.