My adapter is listening for incoming requests (start listening for socket connections on a specific port). This works fine, my notifications work etc.
Problem is that during startup and when developer is used, wM wants to create new instances of my connection. I assume this is because it wants to query some information by calling adapterResourceDomainLookup(…) method specified on WmManagedConnection (and overridden by my own connection implementation).
Now this is not good. Since my connection is listening for incoming requests on a specific tcp port, there can’t be multiple instances of it running simultaneously.
I came up with two solutions: 1) I ignore the errors that occur when another connection is created and tries to listen for the port 2) I create a connection pool that has max one connection. Number one is not good since I might be ignoring some real problems. Number two is not good, since if the connection is enabled and I have a listener for it the only connection is reserved and I can’t for example create new adapter notification in developer, since it can’t get a free connection from the pool.
So the question is: What should I do to avoid the unnecessary instantiation of my connection? All configuration information I return through the resourceDomain lookups is “static” stuff, which I can easily define at development time.
Regards,
Juha