17:50, EEST
March 16, 2017
Hi,
is there anything to take core of when using multiple UaClient Object in one Java application?
So. e.g.
private UaClient client2;
client1 = new UaClient("opc.tcp://server1:4980");
client2 = new UaClient("opc.tcp://server2:4980");
…..
…..
client1.connect()
client2.connect()
Do I have to take care of anything e.g. static settings in any class of the SDK which may cause any problem?
9:16, EEST
Moderators
February 11, 2020
Hello,
There isn’t any limitation on how many instances of UaClient class you can have in one Java application. Naturally, static methods that are used to set values of static fields such as UaClient.setUseCommErrorCodes(boolean) would affect all UaClients.
In general, I would say that there shouldn’t be any problems with any static settings and there are relatively few of them to begin with. But if you do come across any static settings that you would like to be able to control independently for each instance of UaClient or any other SDK class, please let us know and we’ll see if those could be changed.
9:55, EEST
March 16, 2017
10:44, EEST
April 3, 2012
Hi,
Some extra notes from me:
How many UaClients we would be talking? 10s, 100s?, 1000s??
The ‘stack layer’ due to historical reasons do utilize (sometimes very much) shared threadpools in the StackUtils class. The ‘NonBlockingWorkExecutor’ gets equal threads to CPU cores and the ‘BlockingWorkExecutor’ will get 64 threads (configurable via StackUtils.setBlockingWorkerThreadPoolCoreSize(…), this must be called before other interactions with the SDK, start of main etc.).
Also each UaClient does use 2 internal threads (one reads the socket in the ‘stack layer’ and another in the ‘SDK layer’ doing status checks and PublishRequests/Responses).
Also it should be noted that nowadays UaClient does by default Read/Browse the Types part of the server on connect.
Message decoding happens on the blocking work pool (so socket reading can continue), thus it should be noted that while the clients obiviously do not interact with each others per se, they “indirectly do so” by sharing the same “decoding pipe” due to the pool. In practice I would say this is something that you can probably ignore, but is something to we aware; might help later if there are issues (and hopefully increasing the pool size would help then), but let us know if there are any.
Most Users Ever Online: 1919
Currently Online:
20 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Heikki Tahvanainen: 402
hbrackel: 144
rocket science: 88
pramanj: 86
Francesco Zambon: 83
Ibrahim: 78
Sabari: 62
kapsl: 57
gjevremovic: 49
Xavier: 43
Member Stats:
Guest Posters: 0
Members: 735
Moderators: 7
Admins: 1
Forum Stats:
Groups: 3
Forums: 15
Topics: 1523
Posts: 6449
Newest Members:
rust, christamcdowall, redaahern07571, nigelbdhmp, travistimmons, AnnelCib, dalenegettinger, howardkennerley, Thomassnism, biancacraft16Moderators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1026, Jimmy Ni: 26, Matti Siponen: 346, Lusetti: 0
Administrators: admin: 1