Hi,

I'm trying out building some stuff using plc4j/modbus and I have some
questions about that.

I created a very simple test that connects using modbus-tcp and retrieves
some registers.
Essentially it is this example (using the latest snapshot) but with modbus
https://plc4x.apache.org/users/getting-started/plc4j.html
So I use this connect string "modbus-tcp:tcp://127.0.0.1:1502" and request
ModbusTag.of("3x00001:UINT[100]").

The problem I have is that after the data has been read and printed (which
works as expected)  the application does not terminate.


In the console I see (among other things) at the start:
12:17:11,811 [INFO ] PlcDriverManager                        :   48:
Instantiating new PLC Driver Manager with class loader
jdk.internal.loader.ClassLoaders$AppClassLoader@251a69d7
12:17:11,813 [INFO ] PlcDriverManager                        :   52:
Registering available drivers...
12:17:11,818 [INFO ] PlcDriverManager                        :   59:
Registering driver for Protocol modbus-ascii (Modbus ASCII)
12:17:11,819 [INFO ] PlcDriverManager                        :   59:
Registering driver for Protocol modbus-rtu (Modbus RTU)
12:17:11,820 [INFO ] PlcDriverManager                        :   59:
Registering driver for Protocol modbus-tcp (Modbus TCP)
12:17:11,921 [INFO ] TcpChannelFactory                       :   60:
Configuring Bootstrap with ModbusTcpConfiguration{requestTimeout=5000,
unitIdentifier=1}

and after my application finished

12:17:18,022 [INFO ] NettyChannelFactory                     :  150:
Channel is closed, closing worker Group also
12:17:20,025 [INFO ] NettyChannelFactory                     :  154: Worker
Group was closed successfully!

and then it just waits...

When using the debugger in IntelliJ I press pause and have a look at the
threads it seems to me it is stuck in some kind of cleanup I do not
understand.
There is actually a thread called DestroyJavaVM so sounds like outside of
my actual application.

How do I fix this?

-- 
Best regards / Met vriendelijke groeten,

Niels Basjes

Reply via email to