本文介绍了HazelcastInstance与HazelcastClient的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是hazelcast的新手,我有几个问题。

I am novice in hazelcast and I have a few questions.

据我所知,hazelcast附带两个实体 HazelcastInstance (据我所知它是服务器)和 HazelcastClient

这些实体甚至包装在不同的罐子里。

As I understand hazelcast comes with two entities HazelcastInstance(as I understand it is server) and HazelcastClient.
These entities even packed into different jars.

我注意到在我们的项目中我们只使用 HazelcastInstance 。我问同事为什么我们不使用 HazelcastClient 。据我了解他们的解释 HazelcastInstance HazelcastClient 更有可能。因此

I have noticed that in our project we use only HazelcastInstance. I have asked collegues why don't we use HazelcastClient. As I understand their explanation HazelcastInstance has more possibilities than HazelcastClient. Thus

HazelcastInstance = HazelcastClient + AnotherFeatures

但对我来说奇怪的是,如果这些实体是真的,这些实体会打包到不同的包中。

But for me it strange that these entities packed to different packages if it is truth.

请解释我何时应该使用 HazelcastClient 以及何时 HazelcastInstance

Please explain me when should I use HazelcastClient and when HazelcastInstance

推荐答案

正如您所说,HazelcastInstance 是一个Hazelcast成员实例。因此,它存储信息并可以在集群中执行任务。一个 HazelcastClient 虽然只是另一个正在运行的Hazelcast集群的代理。在考虑关系数据库时,您可以将其想象为JDBC连接器。它既不存储数据本身,也不执行通过ExecutorService功能发送的任务。

HazelcastInstance, as you said correctly, is a Hazelcast member instance. Therefore it stores information and can execute tasks in the cluster. A HazelcastClient though is just a proxy to another running Hazelcast cluster. You can imagine it as the JDBC connector when thinking about relational databases. It neither stores data itself, nor does it execute tasks sent through the ExecutorService feature.

如果您的同事将其命名为更多功能,那么公平,我更愿意说服务器 - 服务器环境和客户端 - 服务器环境:)

If your colleague name it "more features", well fair enough, I would prefer to say server-server environment and client-server environment :)

这篇关于HazelcastInstance与HazelcastClient的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 13:24