Spring RMI 配置和使用以及带均衡策略时client端的配置
2014-08-20 14:18
447 查看
client端:
a.不带均衡策略
<bean id="galaxyReportRemoteInterface_0" class="org.springframework.remoting.rmi.RmiProxyFactoryBean" lazy-init="true">
<property name="serviceUrl"><value>${rmi.report1}</value></property>
<property name="serviceInterface" value="com.sogou.earth.web.report.rmi.GalaxyReportRemoteInterface"></property>
<property name="lookupStubOnStartup" value="false"/>
<property name="refreshStubOnConnectFailure" value="true"/>
<property name="registryClientSocketFactory" ref="rmiSocketFactory" />
</bean>
<bean id="rmiSocketFactory" class="net.sf.ehcache.distribution.ConfigurableRMIClientSocketFactory">
<constructor-arg index="0"><value>${rmi.timeout}</value></constructor-arg>
</bean>
b.带均衡策略(RoundRobinStrategy 轮循)
<bean id="galaxyReportRemoteInterfaceSelector" class="com.sogou.earth.web.report.rmi.GalaxyReportRemoteInterfaceSelectorImpl" lazy-init="true">
<property name="rmiSelectStrategy" ref="rmiSelectStrategy"></property>
<property name="targets">
<map>
<entry key="galaxyReportRemoteInterface_0" value-ref="galaxyReportRemoteInterface_0"/>
<entry key="galaxyReportRemoteInterface_1" value-ref="galaxyReportRemoteInterface_1"/>
</map>
</property>
</bean>
<bean id="rmiSelectStrategy" class="com.sogou.earth.web.report.rmi.RoundRobinStrategy" lazy-init="true">
<constructor-arg>
<map key-type="java.lang.String" value-type="java.lang.Integer">
<entry key="galaxyReportRemoteInterface_0" value="1" />
<entry key="galaxyReportRemoteInterface_1" value="1" />
</map>
</constructor-arg>
</bean>
<bean id="galaxyReportRemoteInterface_0" class="org.springframework.remoting.rmi.RmiProxyFactoryBean" lazy-init="true">
<property name="serviceUrl"><value>${rmi.report1}</value></property>
<property name="serviceInterface" value="com.sogou.earth.web.report.rmi.GalaxyReportRemoteInterface"></property>
<property name="lookupStubOnStartup" value="false"/>
<property name="refreshStubOnConnectFailure" value="true"/>
<property name="registryClientSocketFactory" ref="rmiSocketFactory" />
</bean>
<bean id="galaxyReportRemoteInterface_1" class="org.springframework.remoting.rmi.RmiProxyFactoryBean" lazy-init="true">
<property name="serviceUrl"><value>${rmi.report2}</value></property>
<property name="serviceInterface" value="com.sogou.earth.web.report.rmi.GalaxyReportRemoteInterface"></property>
<property name="lookupStubOnStartup" value="false"/>
<property name="refreshStubOnConnectFailure" value="true"/>
<property name="registryClientSocketFactory" ref="rmiSocketFactory" />
</bean>
<bean id="rmiSocketFactory" class="net.sf.ehcache.distribution.ConfigurableRMIClientSocketFactory">
<constructor-arg index="0"><value>${rmi.timeout}</value></constructor-arg>
</bean>
服务端:
<bean id="galaxyReportRemoteInterface" class="com.sogou.galaxy.report.rmi.GalaxyReportRemoteInterfaceImpl" autowire="byName" />
<bean class="org.springframework.remoting.rmi.RmiServiceExporter">
<property name="serviceName" value="galaxyReportRemoteInterface"></property>
<property name="service">
<ref local="galaxyReportRemoteInterface"/>
</property>
<property name="serviceInterface" value="com.sogou.earth.web.report.rmi.GalaxyReportRemoteInterface">
</property>
<property name="registryPort"><value>${rmi.stub.business.port}</value></property>
</bean>
a.不带均衡策略
<bean id="galaxyReportRemoteInterface_0" class="org.springframework.remoting.rmi.RmiProxyFactoryBean" lazy-init="true">
<property name="serviceUrl"><value>${rmi.report1}</value></property>
<property name="serviceInterface" value="com.sogou.earth.web.report.rmi.GalaxyReportRemoteInterface"></property>
<property name="lookupStubOnStartup" value="false"/>
<property name="refreshStubOnConnectFailure" value="true"/>
<property name="registryClientSocketFactory" ref="rmiSocketFactory" />
</bean>
<bean id="rmiSocketFactory" class="net.sf.ehcache.distribution.ConfigurableRMIClientSocketFactory">
<constructor-arg index="0"><value>${rmi.timeout}</value></constructor-arg>
</bean>
b.带均衡策略(RoundRobinStrategy 轮循)
<bean id="galaxyReportRemoteInterfaceSelector" class="com.sogou.earth.web.report.rmi.GalaxyReportRemoteInterfaceSelectorImpl" lazy-init="true">
<property name="rmiSelectStrategy" ref="rmiSelectStrategy"></property>
<property name="targets">
<map>
<entry key="galaxyReportRemoteInterface_0" value-ref="galaxyReportRemoteInterface_0"/>
<entry key="galaxyReportRemoteInterface_1" value-ref="galaxyReportRemoteInterface_1"/>
</map>
</property>
</bean>
<bean id="rmiSelectStrategy" class="com.sogou.earth.web.report.rmi.RoundRobinStrategy" lazy-init="true">
<constructor-arg>
<map key-type="java.lang.String" value-type="java.lang.Integer">
<entry key="galaxyReportRemoteInterface_0" value="1" />
<entry key="galaxyReportRemoteInterface_1" value="1" />
</map>
</constructor-arg>
</bean>
<bean id="galaxyReportRemoteInterface_0" class="org.springframework.remoting.rmi.RmiProxyFactoryBean" lazy-init="true">
<property name="serviceUrl"><value>${rmi.report1}</value></property>
<property name="serviceInterface" value="com.sogou.earth.web.report.rmi.GalaxyReportRemoteInterface"></property>
<property name="lookupStubOnStartup" value="false"/>
<property name="refreshStubOnConnectFailure" value="true"/>
<property name="registryClientSocketFactory" ref="rmiSocketFactory" />
</bean>
<bean id="galaxyReportRemoteInterface_1" class="org.springframework.remoting.rmi.RmiProxyFactoryBean" lazy-init="true">
<property name="serviceUrl"><value>${rmi.report2}</value></property>
<property name="serviceInterface" value="com.sogou.earth.web.report.rmi.GalaxyReportRemoteInterface"></property>
<property name="lookupStubOnStartup" value="false"/>
<property name="refreshStubOnConnectFailure" value="true"/>
<property name="registryClientSocketFactory" ref="rmiSocketFactory" />
</bean>
<bean id="rmiSocketFactory" class="net.sf.ehcache.distribution.ConfigurableRMIClientSocketFactory">
<constructor-arg index="0"><value>${rmi.timeout}</value></constructor-arg>
</bean>
服务端:
<bean id="galaxyReportRemoteInterface" class="com.sogou.galaxy.report.rmi.GalaxyReportRemoteInterfaceImpl" autowire="byName" />
<bean class="org.springframework.remoting.rmi.RmiServiceExporter">
<property name="serviceName" value="galaxyReportRemoteInterface"></property>
<property name="service">
<ref local="galaxyReportRemoteInterface"/>
</property>
<property name="serviceInterface" value="com.sogou.earth.web.report.rmi.GalaxyReportRemoteInterface">
</property>
<property name="registryPort"><value>${rmi.stub.business.port}</value></property>
</bean>
相关文章推荐
- SpringCloud(第 007 篇)电影微服务,使用定制化 Ribbon 在客户端进行负载均衡,使用 RibbonClient 不同服务不同配置策略
- SpringCloud(第 007 篇)电影微服务,使用定制化 Ribbon 在客户端进行负载均衡,使用 RibbonClient 不同服务不同配置策略
- SpringCloud(第 007 篇)电影微服务,使用定制化 Ribbon 在客户端进行负载均衡,使用 RibbonClient 不同服务不同配置策略
- 在 IIS 6 和 IIS 7中配置Https,设置WCF同时支持HTTP和HTPPS,以及使用HttpWebRequest和HttpClient调用HttpS
- Kafka 0.9+Zookeeper3.4.6集群搭建、配置,新Client API的使用要点,高可用性测试,以及各种坑 (转载)
- Kafka 0.9+Zookeeper3.4.6集群搭建、配置,新Client API的使用要点,高可用性测试,以及各种坑
- Kafka 0.9+Zookeeper3.4.6集群搭建、配置,新Client API的使用要点,高可用性測试,以及各种坑
- Kafka 0.9+Zookeeper3.4.6集群搭建、配置,新Client API的使用要点,高可用性测试,以及各种坑
- Kafka 0.9+Zookeeper3.4.6集群搭建、配置,新Client API的使用要点,高可用性测试,以及各种坑
- 策略路由以及使用 ip route , ip rule , iptables 配置策略路由实例
- Kafka 0.9+Zookeeper3.4.6集群搭建、配置,新Client API的使用要点,高可用性测试,以及各种坑 (转载)
- svn简单配置以及使用
- 回发或回调参数无效。在配置中使用 或在页面中使用 启用了事件验证。出于安全目的,此功能验证回发或回调事件的参数是否来源于最初呈现这些事件的服务器控件。如果数据有效并且是预期的,则使用 ClientScriptManager.RegisterForEventValidation 方法来注册回发或回调数据以进行验证。
- Control Study->AdRotator广告控件显示自定义配置文件中广告以及与DataGrid控件结合使用显示图片(示例代码下载)
- Quartz.net官方开发指南 第十课: 配置、资源使用以及SchedulerFactory
- Quartz.net官方开发指南 第十课: 配置、资源使用以及SchedulerFactory
- Quartz.net官方开发指南 第十课: 配置、资源使用以及SchedulerFactory
- 7609上策略路由及使用防火墙NAT进行双出口接入配置
- 使用设备安全管理器配置设备安全策略
- 使用设备安全管理器配置设备安全策略