This post checking-for-similar-controllers would seem to indicate that controller connection/disconnection functionality doesn't exist. Our GUI has a requirement to detect when a device gets removed (e.g. cable pulling ) currently it does this by allocating a DirectAndRawInputEnvironmentPlugin object - on a timer (once a second).
However, if the device is left unplugged for over nine hours the app freezes and an OOME is thrown. jvisualvm's memory sampler indicated that the DIDeviceObject had quite a few instances occupying a large chunk of memory which doesn't get released until the app closes. Binaries for the Jinput java code were replaced with library java source code to facilitate debugging etc, after reviewing the constructor for the DirectInputEnvironmentPlugin I noticed that there was a ShutdownHook added as a privileged action. After commenting out the ShutdownHook code, the memory leak was resolved but the code still fails (in a different way) as the library fails to create a dummy window needed for win32 device enumeration. I've tried to build the jinput library to debug the dll but have failed todo so thus far, Java as not been on my radar until now so everything is new !.
Any ideas regarding any of the above gratefully received.