Skip to content

Upgrading from v1.06

Steve O'Hara edited this page Apr 28, 2018 · 2 revisions

Known Issues with j2mod 1.06

Reliance on RxTxComm

This comms library is not supported and it's installation mechanism is both antiquated and cumbersome. It has a horrible locking mechanism and is impenetrable to most developers.

It is also hard to get binary versions created for new platforms.

It's Not Maven

Love it or hate it, Maven underpins an enormous swathe of open source projects and it makes life a lot simpler if you can just point to a POM and build a project.

It also makes it simpler to get the library 'out there' if it can be hosted on Maven Central.

General Problems

  • Although not necessarily a bug, the codebase likes to use a lot of in-line synchronisation on non-final objects, which at best is poor practise and at worst, unreliable.
  • There's a lot of repetition in the code
  • The javadoc also needs some attention - missing descriptions, incorrect tags etc.
  • The format is inconsistent and in places a bit clumsy - it suffers from having originated on editors that were probably limited in width
  • There is no logging framework support, all messages are written to the System.out stream
  • Although there are a lot of test applications, there is no automation (junit)
  • Static code analysis reveals a huge number of potential problems
  • The threading system is naive and lacks proper shutdown mechanisms (relies on process death to clean up)

Upgrading to v2.0

The v2.0 library is completely compatible with v1.06 up until v2.5.0. v2.5.1 has re-factored a number of interfaces and dropped the ModbusCoupler instance. No functionality has been removed, just refactored to make more sense and be performant.

Just drop the new JAR file into your project either by including it in your local repo or by adding it to your pom as follows;

<dependency>
    <groupId>com.ghgande</groupId>
    <artifactId>j2mod</artifactId>
    <version>2.0</version>
</dependency>