hazelcast

Store and filter on list of values for a key in Hazelcast

淺唱寂寞╮ 提交于 2020-06-01 05:03:12
问题 My database call returns a list of values for a key and I need to use Hazelcast as a cache in spring to store these values. I am able to store it as (key, List) in IMap but by doing so I am unable to apply filters on these items for a key using something like Predicates for Hazelcast. I would also like it to support pagination for the list of values. Already heard something about MultiMaps but unable to configure the same in springboot and also unsure whether it siffices the above use case.

openfire配置中常见错误

独自空忆成欢 提交于 2020-05-06 06:50:38
openfire配置中常见错误 1.异常:配置文件报错:不允许有匹配 "[xX][mM][lL]" 的处理指令目标 解决方法: 规范的XML格式: <?xml version="1.0" encoding="UTF-8"?> 必须是XML文件的第一个元素且前面不能空格。 2.异常:Compile failed; see the compiler error output for details. 解决方法:编码统一 一般都是中文字符出现问题,找到异常文件定位,修改文件编码(myeclipse): Edit->Set Encoding 3.异常:Openfire 代码部署报错: Variable references non-existent resource:${workspace_loc:openfire_src} 解决方法:路径不正确。 4.集群配置中异常:java.lang.IllegalArgumentException: PortableFactory[-21] is already registered! com.hazelcast.concurrent.atomicreference.client.AtomicReferencePortableHook$1@1ea8ee25 -> com.hazelcast.concurrent.atomicreference

ff4j 一些高级概念

杀马特。学长 韩版系。学妹 提交于 2020-04-21 16:13:08
feature groups 通过feature groups 我们可以将同一个release 实例的feature 聚合起来,灵活管理 参考配置 <? xml version = "1.0" encoding = "UTF-8" ?> < features > <!-- Sample Feature Group --> < feature - group name = "release-2.3" > < feature uid = "users-story1" enable = "false" /> < feature uid = "users-story2" enable = "false" /> < /feature-group> ​ < feature uid = "featA" enable = "true" /> < feature uid = "featB" enable = "false" /> < /features> 代码访问 @ Test public void myGroupTest() { FF4j ff4j = new FF4j( "ff4j-groups.xml"); ​ // Check features loaded assertEquals( 4, ff4j. getFeatures(). size()); assertTrue( ff4j.

如何保证缓存和数据库一致性

人盡茶涼 提交于 2020-03-25 18:40:57
3 月,跳不动了?>>> [TOC] 多年前在一次面试中,被问到如果数据更新,先修改数据库还是先修改缓存。因为没有想过,所以比较懵逼,时候赶紧搜索,发现这里面很有学问。基本上所有的文章最终都指向了两个地方,就是 Oracle 和 Hazelcast 对缓存更新策略的介绍。 Cache-Aside 常见的应用端策略,从数据库加载数据到缓存的模式。 应用服务自己选择是否使用缓存,并维护缓存的生命周期。这是最简单的实现方式,但是会有遇到一些问题。分为两种情况: 读取数据 检查缓存遗漏,然后查询数据库,填充缓存 尝试读缓存 如果命中,返回数据 如果未命中,查询数据库,并写入缓存 这会导致缓存击穿,需要双重检查锁定(Double Check Lock)确保单个线程访问数据库,但是会增加锁开销。 修改数据 修改数据库和缓存,因为缓存和数据库是两个系统,操作的先后顺序会导致一致性问题。 通常由几种方案: 先更新数据库,后更新缓存 如果两个线程同时更新,先更新的线程因为某些原因(时间片耗尽),后更新缓存,那么缓存里就是脏数据。 participant 业务 participant 数据库 participant 缓存 业务->数据库: A线程:更新 业务->数据库: B线程:更新 数据库->数据库: A线程:挂起 数据库->缓存: B线程:更新 数据库->缓存: A线程:更新 先更新缓存

mqtt协议-broker之moqutte源码研究六之集群

旧街凉风 提交于 2020-03-07 02:10:36
moquette的集群功能是通过Hazelcast来实现的,对Hazelcast不了解的同学可以自行Google以下。 在讲解moquette的集群功能之前需要讲解一下moquette的拦截器,因为moquette对Hazelcast的集成本身就是通过拦截器来实现的。 一。拦截器 io.moquette.spi.impl.ProtocolProcessor类里面有一个BrokerInterceptor类,这个类就是broker拦截器,这个对象,在processConnect,processPubAck,processPubComp,processDisconnect,processConnectionLost,processUnsubscribe,processSubscribe,processPublish等八个地方都用到了,说明在broker处理各个报文的关键期间都会用到,我们先看一这个类的结构 private static final Logger LOG = LoggerFactory.getLogger(BrokerInterceptor.class); private final Map<Class<?>, List<InterceptHandler>> handlers; private final ExecutorService executor; private

如何在Eureka中使用Hazelcast自动发现

霸气de小男生 提交于 2020-03-02 08:47:23
Hazelcast IMDG supports auto-discovery for many different environments. Since we introduced the generic discovery SPI , a lot of plugins were developed so you can use Hazelcast seamlessly on Kubernetes , AWS , Azure , GCP , and more. Should you need a custom plugin, you are also able to create your own. If your infrastructure is not based on any popular Cloud environment, but you still want to take advantage of the dynamic discovery rather than static IP configuration, you can set up your service registry. One of the more popular choices, especially in the JVM-based microservice world, is

记一次session获取为空的异常处理

走远了吗. 提交于 2020-03-01 06:10:40
原本服务器端是单机tomcat运行,接口端获取请求响应的cookie中的jsessionid值作为以后请求的cookie,这样就可以使用session了 将服务器端升级成分布式的,使用hazelcast做缓存并保存session,这时候接口端请求获取session都是null 原因:Jsessionid只是tomcat的对sessionid的叫法,其实就是sessionid;在其它的容器也许就不叫jsessionid,而接口端是写死的Jsessionid=**** 查看了浏览器端的接口,响应是session=***********,意味着hazelcast获取cookie的值不是Jsessionid,而是session,cookie应该同样使用"session"做为标识 同理:如果使用其他方式保存session,需要注意sessionid的name值不能写死了,要根据响应的值,判断session标识 来源: oschina 链接: https://my.oschina.net/u/1428688/blog/3101481

maven私服搭建

倖福魔咒の 提交于 2020-02-27 10:02:05
私服环境搭建 nexus搭建 https://www.cnblogs.com/sybblogs/p/9835977.html https://blog.csdn.net/chenfei2341/article/details/80431700 https://www.cnblogs.com/qdhxhz/p/9801325.html admin/admin123 默认密码为当nexus解压之后会有两个文件夹nexus3.x和sonatype-work 默认的密码在sonatype-work文件夹下,会有一个admin.password,登录后修改 集成本地maven 修改nexus默认密码 更改配置 [root[@localhost](https://my.oschina.net/u/570656) etc]# pwd /usr/local/jysemel/sonatype-work/nexus3/etc [root[@localhost](https://my.oschina.net/u/570656) etc]# [root[@localhost](https://my.oschina.net/u/570656) etc]# [root[@localhost](https://my.oschina.net/u/570656) etc]# [root[@localhost]

Spring Boot Admin的使用

醉酒当歌 提交于 2020-02-27 07:53:36
前面的文章我们讲了Spring Boot的Actuator。但是Spring Boot Actuator只是提供了一个个的接口,需要我们自行集成到监控程序中。今天我们将会讲解一个优秀的监控工具Spring Boot Admin。 它采用图形化的界面,让我们的Spring Boot管理更加简单。 先上图给大家看一下Spring Boot Admin的界面: 从界面上面我们可以看到Spring Boot Admin提供了众多强大的监控功能。那么开始我们的学习吧。 配置Admin Server 既然是管理程序,肯定有一个server,配置server很简单,我们添加这个依赖即可: < dependency > < groupId > de.codecentric </ groupId > < artifactId > spring-boot-admin-starter-server </ artifactId > < version > 2.2.2 </ version > </ dependency > 同时我们需要在main程序中添加@EnableAdminServer来启动admin server。 @EnableAdminServer @SpringBootApplication public class SpringBootAdminServerApplication {

Hazelcast: Execute EntryEvictedListener only once per cluster in client mode

久未见 提交于 2020-02-25 00:42:46
问题 We are connecting to Hazelcast cluster using Java clients from multiple nodes. HazelcastClient.newHazelcastClient(cfg) We need our EntryEvictedListener to be executed only once per cluster. By default it is executed on all connected clients. Found how to reach this goal with Hazelcast embedded (Time Based Eviction in Hazelcast), but looks like map.addLocalEntryListener(...) is not allowed for client. So is there any way to execute eviction listener only once per cluster using client? 回答1: