sdenier / GecoSI

Open-source Java library to use the SPORTident timing system. Developed for Geco.
http://github.com/sdenier/Geco
MIT License
9 stars 3 forks source link

Architectural changes #7

Open ghost opened 8 years ago

ghost commented 8 years ago

Hi @sdenier ,

As discussed last October, I have started another app which uses GecoSI (http://orientbase.org). While integrating GecoSi in my app, I have made several changes in my fork (check out the v2 branch):

The goal of this ticket is to track the (high level) changes I would like to implement in the future to have an opportunity for discussion (both with you and any other user of GecoSI).

Threads

This was probably not th case with RxTx but the jSSC lib already creates one thread when you add a listener to a SerialPort... so we currently end up with 3 threads for each open port. I would think that GecoSI should not create a single thread any longer... Just rely on the jSSC thread and then let the port listener populate a blocking queue that the lib client would then poll (up to him to create threads at wish: these are architectural considerations well above the scope of such a lib IMO).

Reliability

This may come from my switching to jSSC, but during my testing, I noticed that I could end up with a busy-port error although the OS does not see it open (lsof /dev/ttyUSB0 returns nothing). This occurred when unplugging the readout control etc... so it's not a big deal. In Geco it is not a real issue as it is a single user app, but in cases where multiple users are connected on the app, it would undesirable to have to restart the app to clear an internal busy flag.

Logging

GecoSI should not create log files on its own... instead it should integrate in the logging system of the host program. This could be done by logging against an interface library such as slf4j.

Obviously all this will not be possible by maintaining compatibility with the current existing code, hence the v2 (major version bump).

I will carry on feeding here if anything else arises. Cheers

sdenier commented 8 years ago

Well some aspects of Java development, I will leave to you as I have never used it in a true professional context.

I don't know how/when I can reintegrate that into Geco. But since the current version is stable, I see no problem in having a new branch for a major 2.x release...

Where is the doc for jSSC? I could not find one...

ghost commented 8 years ago

The doc?? Well, that's a very good question indeed! It's been a month since I did the switch so I cannot remember for sure, but I could not find any doc this morning either. You may find some tutos on YouTube and other general programming websites...

So, I think switched the dependency and read the source code (at least the doc is up to date there ;-) ) to understand the required changes until it compiled again.

You may see what I changed in the commit history on the v2 branch of my fork.

As for the proposed changes, I will be happy to implement them in the v2 branch if you don't have a problem with that. I am currently working on the non-SI aspects of OrientBase though so it will be some time later.