Starttransaction, Starttransaction m, Starttransaction and starttransaction m – Echelon OpenLNS User Manual

Page 908

Advertising
background image

OpenLNS Programmer's Reference

871

requests.
You only use this parameter if the

mode parameter is set to

lcaEventAutoSyncMode.

Added to API

LNS Release 3.0.

StartTransaction

Summary

Starts a transaction for the

System

object. You should call

this method in combination with

CommittTransaction

to

group method invocations and property modifications as part

of the same transaction.

If a transaction initiated by your client is already in progress

for the System when you call this method, an exception will

be thrown. You can complete the transaction by calling the

CommittTransaction

method, or you can cancel the

transaction by calling the CancelTransaction method.
When a transaction is canceled, either explicitly or due to a

reset, all L

ON

W

ORKS

network and database changes made

since the call to StartTransaction are reversed.
If a transaction is aborted after this method is called, all

future services will return an error until the client cancels

the transaction using the CancelTransaction method.
Using transactions can increase performance dramatically in

some cases. There is a constant overhead for starting and

committing transactions, but no updates are propagated on

the network and no changes are written to disk until the

transaction is committed. This greatly increases performance

when performing multiple coordinated changes to your

database. Transactions, however, consume memory, and if an

excessive number of changes are made during a single

transaction, the resulting overhead may slow down the

overall process.
You should use transactions to synchronize changes so that

only one client can have a transaction open at a time. While

one client is making a change in a transaction, other clients

will be paused while waiting to gain the transaction lock.

Some database operations will implicitly create a

transaction, and they will therefore wait for the other client

to complete its transaction before that operation will

continue.
Transactions can also be used to perform "atomic" sets of

changes, which are changes that require a series of calls to

LNS to be made. For example, moving an application device

or router is an operation that could be performed within a

transaction. If any of the calls made during such a

transaction fails, all of the changes made up to that point can

be undone by simply cancelling the transaction.
For more detailed information on when you should use

Advertising