For remote calls, yes, they return the instance to the pool, and the value 10 remains.
For in-process calls, no. That is a bug on our side, it is fixed and will be in the next release.
In the meantime, return the instance to the class factory yourself instead of calling Engine.ReleaseLocalService:
// serviceName — the same name you pass to Engine.AcquireLocalService today
var factory = RemObjects.SDK.Server.Engine.ServiceManager.GetService(serviceName).ClassFactory;
var service = factory.AcquireInstance(sessionId); // activates it
try
{
// your call on the service instance
}
finally
{
factory.ReleaseInstance(sessionId, service); // deactivates and returns it to the pool
}
For LocalDataAdapter, acquire the instance the same way and assign it to the adapter’s ServiceInstance property an instance supplied from outside is not disposed by the adapter.
One thing to avoid until the fix: do not switch to PoolBehavior.Wait or Fail. The pool’s “in use” counter is leaked along with the instance, so Fail raises ObjectPoolExhaustedException and Wait blocks forever, even on an idle server.
The attached project runs both variants side by side against your installed Data Abstract open workaround and run.