Spring.net Service 配置Remoting示例
2010-08-23 13:53
337 查看
相关概念:
SAO,CAO
SingleTon(默认),SingleCall
用Spring.net 配置发布Remoting,服务器对象不需要继承MarshByRefObject,而是一个原生的PONO(plain .net object)。spring.net在运行时创建一个proxy继承MarshByRefObject.
Client端配置及调用
<!--cao Services-->
<object id="caoCalculatorServiceOld" type="Spring.Remoting.CaoFactoryObject, Spring.Services">
<property name="RemoteTargetName" value="caoCalculator" />
<property name="ServiceUrl" value="tcp://localhost:8080" />
</object>
<r:caoFactory id="caoCalculatorService"
remoteTargetName="caoCalculator"
serviceUrl="tcp://localhost:8080" />
cs代码:
ICalculator caoCalc = (ICalculator)ctx.GetObject("caoCalculatorServiceOld");
Console.WriteLine("cao multiply:"+ caoCalc.Multiply(10, 20));
ICalculator caoNewCalc = (ICalculator)ctx.GetObject("caoCalculatorService");
Console.WriteLine("cao multiply:" + caoNewCalc.Add(10, 20));
ILease.RenewOnCallTime Property
Gets or sets the amount of time by which a call to the remote object renews the CurrentLeaseTime.
Namespace: System.Runtime.Remoting.Lifetime
Assembly: mscorlib (in mscorlib.dll)
ILease Properties
The ILease type exposes the following members.
Properties
Top
SAO,CAO
SingleTon(默认),SingleCall
用Spring.net 配置发布Remoting,服务器对象不需要继承MarshByRefObject,而是一个原生的PONO(plain .net object)。spring.net在运行时创建一个proxy继承MarshByRefObject.
Client端配置及调用
<!--cao Services-->
<object id="caoCalculatorServiceOld" type="Spring.Remoting.CaoFactoryObject, Spring.Services">
<property name="RemoteTargetName" value="caoCalculator" />
<property name="ServiceUrl" value="tcp://localhost:8080" />
</object>
<r:caoFactory id="caoCalculatorService"
remoteTargetName="caoCalculator"
serviceUrl="tcp://localhost:8080" />
cs代码:
ICalculator caoCalc = (ICalculator)ctx.GetObject("caoCalculatorServiceOld");
Console.WriteLine("cao multiply:"+ caoCalc.Multiply(10, 20));
ICalculator caoNewCalc = (ICalculator)ctx.GetObject("caoCalculatorService");
Console.WriteLine("cao multiply:" + caoNewCalc.Add(10, 20));
ILease.RenewOnCallTime Property
Gets or sets the amount of time by which a call to the remote object renews the CurrentLeaseTime.
Namespace: System.Runtime.Remoting.Lifetime
Assembly: mscorlib (in mscorlib.dll)
ILease Properties
The ILease type exposes the following members.
Properties
Name | Description | |
---|---|---|
CurrentLeaseTime | Gets the amount of time remaining on the lease. | |
CurrentState | Gets the current LeaseState of the lease. | |
InitialLeaseTime | Gets or sets the initial time for the lease. | |
RenewOnCallTime | Gets or sets the amount of time by which a call to the remote object renews the CurrentLeaseTime. | |
SponsorshipTimeout | Gets or sets the amount of time to wait for a sponsor to return with a lease renewal time. |
相关文章推荐
- spring 通过配置向quartz 注入service
- maven dao和service工程,spring 扫描jar中配置文件nullpointer的问题
- Spring(15):为业务层Service 配置声明式事务(下)-- @Transactional注解配置
- spring spring scheduled配置示例
- spring基于java配置@Configuration和@Bean用法【代码示例】
- spring_webservice_Hessian和Burlap配置示例
- Java-Spring-WebService最基础的配置示例
- Spring.NET 中配置 ashx 的映射,以及其它各种映射的处理 的特殊情况
- Spring的事务到底该给Dao配置还是给Service配置?
- Spring.net与Asp.net Mvc结合示例
- Spring配置时异常net/sf/ehcache/E…
- .net Remoting(1)——起点,从示例做起
- ASP.NET MVC 1.0 + spring.net 1.2.0.20288 + NHibernate 2.0.1.4000整合笔记(二)——spring.net配置
- spring.net 事务和 安全 配置
- Spring.net 控制反转(IOC)依赖注入(DI)的使用 以及Config文件的配置
- spring 通过配置向quartz 注入service
- Spring.NET学习笔记20——整合Remoting(应用篇) Level 200
- how to design a hardware service use .net remoting
- 在 Spring.NET 中使用 PropertyPlaceholderConfigurer 设置配置参数
- Spring配置事务管理,service端通过@Transactional注解