openfire源码学习

openfire以会话的方式描述通信过程,包括ClientSession上述继承类等。

ClientSession:Represents a session between the server and a client.(客户端-服务器)

LocalSession:The session represents a connection between the server and a client (c2s) or another server (s2s) as well as a connection with a component.(客户端-服务器、服务器-服务器)

RemoteSession:Base class for sessions being hosted in other cluster nodes. Almost all messages will be forwarded to the actual session in some remote cluster node.(用于集群)

ComponentSession:Represents a session between the server and an external component(服务器-模块)

ConnectionMultiplexerSession:Represents a session between the server and a connection manager(服务器-连接管理)

IncomingServerSession:The IncomingServerSession represents the connection to a remote server that will only be used for receiving packets.(S2S接收数据服务会话)

OutgoingServerSession:The OutgoingServerSession represents the connection to a remote server that will only be used for sending packets.(S2S发送数据服务会话)

LocalClientSession:Represents a session between the server and a client(继承LocalSession并实现ClientSession接口,服务器-客户端会话)

RemoteClientSession: Surrogate for client sessions hosted in some remote cluster node(远程节点会话,用于集群)

 

集群概念链接:http://blog.csdn.net/jerryhui8411/article/details/4445136:集群两大特性:可扩展性和高可用性,主要用于负载均衡和错误恢复。

 

摘抄自上述链接:

实现集群务必要有以下两大技术:

  • 集群地址--集群由多个服务实体组成,集群客户端通过访问集群的集群地址获取集群内部各服务实体的功能。具有单一集群地址(也叫单一影像)是集群的一个基本特征。维护集群地址的设置被称为负载均衡器。负载均衡器内部负责管理各个服务实体的加入和退出,外部负责集群地址向内部服务实体地址的转换。有的负载均衡器实现真正的负载均衡算法,有的只支持任务的转换。只实现任务转换的负载均衡器适用于支持ACTIVE-STANDBY的集群环境,在那里,集群中只有一个服务实体工作,当正在工作的服务实体发生故障时,负载均衡器把后来的任务转向另外一个服务实体。
  • 内部通信--为了能协同工作、实现负载均衡和错误恢复,集群各实体间必须时常通信,比如负载均衡器对服务实体心跳测试信息、服务实体间任务执行上下文信息的通信。

具有同一个集群地址使得客户端能访问集群提供的计算服务,一个集群地址下隐藏了各个服务实体的内部地址,使得客户要求的计算服务能在各个服务实体之间分布。内部通信是集群能正常运转的基础,它使得集群具有均衡负载和错误恢复的能力

 

 

 

 

 

 

posted @ 2013-03-17 21:30  wang_tale  阅读(576)  评论(0编辑  收藏  举报