Code Reference
- ClientFactory.java:88 : ClientFactory.start()
- ClientFactory.java:97: ClientFactory.stop()
To reproduce
When the following pattern is used:
ClientFactory.start();
// ... execute pvAccess request
ClientFactory.stop();
the static factory property in ClientFactory is set to a new ChannelProviderFactoryImpl() in ClientFactory.start() but is not cleared in ClientFactory.stop() if factory.destroySharedInstance() fails, even though the factory itself is unregistered. This means that the guard condition in ClientFactory.start() will prevent re-registering of the ChannelProviderFactory and thus all subsequent pvAccess requests fail. In slow network conditions I find that factory.destroySharedInstance() fails more often than not.
Problem:
When implementing a pvAccess executor for a scripted language in a slow network environment this pattern does not work because only the first pvAccess request works. I have to omit the ClientFactory.stop() to make subsequent pvAccess requests work.
Suggestion/Possible fix:
Set static ClientFactory.factory to null whether the factory.destroySharedInstance() succeeds or not. ClientFactory.java:103