I am trying to make a ServicedComponent with object pooling enabled and
publish him for access by remoting with binary serialization in tcp
channel.
Code:
1:      [ObjectPooling(Enabled=true, MinPoolSize=2, MaxPoolSize=10)]
2:      [JustInTimeActivation(true)]
3:      [EventTrackingEnabled]
4:      public class Engine : ServicedComponent, IEngine, IDisposable {
5:              public DoWork() {...}
6:              protected override void Activate() {
7:                      base.Activate();
8:              }
9:              protected override void Deactivate() {
10:                     base.Deactivate();
11:             }
12:             protected override bool CanBePooled() {
13:                     return true;
14:             }
15:     }

In remoting configuration file Engine class is configured as Well-known
object with SingleCall activation.
Engine object is hosted in Console application.
Client aplications are playing next scenario:
1. Obtain instance of Engine by Activator.GetObject(...)
2. Call DoWork method
3. Exit (without Dispose calling, because if I call Dispose
RemotingException occurred with message "Attempted to call a method
declared on type System.IDisposable on an object which exposes
Test.Server.")

While clients are running I can see in COM+ Admin that columns:
Object = x, Activated = x, In Call = y, Call Time = z
And Pooled is empty.

So, when tenth client connect to the server it is stopped in wait for
connecting.
In this time no other client connected to server but Activated column ==
10.

Questions:
1. Why pooled column is empty?
2. Engine objects are pooled or not pooled in my case?
3. What can I do to bring pooling to work?

Thank you.
--
Andrey Shvydky
ILS-Ukraine, Developer

Reply via email to