oz_ko
10-31-2006, 04:14 AM
Hi all,
I have a somewhat odd requirement: I have to create a single remote object that can only be accessed by one client at a time. The remote object needs to use the serial port so it can't be reused by a second client until it is released by the first client.
I've tried creating an object pool of with a maxSize of 1 but it has no effect. i.e. multiple clients can still access the object.
<object id="serialAgentTarget" type="SerialService.SerialAgent, SerialService" singleton="false" >
<property name="CommControl" ref="commControl"/>
</object>
<!-- There can be only one! -->
<object id="poolTargetSource" type="Spring.Aop.Target.SimplePoolTargetSource, Spring.Aop">
<property name="targetObjectName" value="serialAgentTarget"/>
<property name="maxSize" value="1"/>
</object>
<object id="serialAgent" type="Spring.Aop.Framework.ProxyFactoryObject, Spring.Aop">
<property name="targetSource">
<ref local="poolTargetSource"/>
</property>
</object>
sao.xml
<?xml version="1.0" encoding="utf-8" ?>
<objects xmlns="http://www.springframework.net" xmlns:r="http://www.springframework.net/remoting">
<r:saoExporter targetName="serialAgent" serviceName="RemotedSaoSerialAgent" infinite="true"/>
</objects>
Can multiple clients still access the remote object because of the remoting proxy, or is there some other reason?
Is there a better way to do this?
Thanks
Oz
I have a somewhat odd requirement: I have to create a single remote object that can only be accessed by one client at a time. The remote object needs to use the serial port so it can't be reused by a second client until it is released by the first client.
I've tried creating an object pool of with a maxSize of 1 but it has no effect. i.e. multiple clients can still access the object.
<object id="serialAgentTarget" type="SerialService.SerialAgent, SerialService" singleton="false" >
<property name="CommControl" ref="commControl"/>
</object>
<!-- There can be only one! -->
<object id="poolTargetSource" type="Spring.Aop.Target.SimplePoolTargetSource, Spring.Aop">
<property name="targetObjectName" value="serialAgentTarget"/>
<property name="maxSize" value="1"/>
</object>
<object id="serialAgent" type="Spring.Aop.Framework.ProxyFactoryObject, Spring.Aop">
<property name="targetSource">
<ref local="poolTargetSource"/>
</property>
</object>
sao.xml
<?xml version="1.0" encoding="utf-8" ?>
<objects xmlns="http://www.springframework.net" xmlns:r="http://www.springframework.net/remoting">
<r:saoExporter targetName="serialAgent" serviceName="RemotedSaoSerialAgent" infinite="true"/>
</objects>
Can multiple clients still access the remote object because of the remoting proxy, or is there some other reason?
Is there a better way to do this?
Thanks
Oz