Thursday, October 26, 2017

Version 2 of the Time2 Library and CrNiCKL

New versions of the Time2 Library and of CrNiCKL have been released on October 5, 2017.

The software can be found on GitHub and in Maven Central. Various resources are available on the Time2 Library project website and the CrNiCKL project website.

Most changes are in the Time2 Library and can be summarized as:

  • improved thread safety, achieved by the elimination of TimeDomainFactory, TimeSeriesFactory, and ExternalTimeFormat;
  • partial reorganization of the package structure;
  • support for nanoseconds;
  • various fixes and improvements.
Consult the release notes for more details.

Version 2.0.0 of the Time2 Library is not fully compatible with version 1.1.7. Due to the elimination and replacement of some classes and interfaces, a minimum of application recoding is unavoidable. It is in principle limited to initialization code. In addition, the reorganization of packages makes it necessary to reorganize imports.

The important change is the improvement of thread safety. Factories were implemented as singletons and thread safety was enforced with the help of synchronized methods. In rare and hard-to-replicate cases, the software experienced deadlocks. To address the issue, all singletons have been eliminated. The functionality is of course still available. It is implemented by using injection and immutable objects. The new approach does not require any synchronization and is inherently safer. As a bonus, it also makes testing easier.

Instead of TimeDomainFactory, applications use a TimeDomainCatalog, implemented as an immutable object with all time domains passed as parameters to the constructor. The role of TimeSeriesFactory has been taken over by public constructors of RegularTimeSeries and SparseTimeSeries. The functionality of ExternalTimeFormat has been split into TimeScanner and TimeFormatter.

The CrNiCKL database software depends on the Time2 Library and has been upgraded. Its version 2.0.0 is likewise incompatible with the previous one, 1.2.1. The JDBC and MongoDB drivers have also been upgraded. Use crnickl-jdbc 2.0.1 and crnickl-mongodb 2.0.1 instead of 2.0.0; the 2.0.0 versions have a glitch in their POMs and cannot be used for unit testing.

The demos on GitHub have been updated and provide a simple illustration of how to use the new versions. The direct links are time2lib-demo and crnickl-demo.

Wednesday, May 1, 2013

New CrNiCKL version addresses issue with JUnit and Java 7

Version 1.2.1 of crnickl was released yesterday April 30, 2013. It comes with a small improvement to the API and addresses a problem with unit tests under Java 7

API improvement

The Database interface declares a new method named makeSurrogate to turn a string into a Surrogate. The string is typically produced by a surrogate's toString method. It was previously not possible to create a surrogate from such a string without making some assumptions and using low-level methods.

Issue with JUnit and Java 7

JUnit tests written with JUnit are usually short pieces of code which can be run independently of each other. However, when writing test cases for a database system, it is often handy to assume that test methods are executed in a predictable order, for example in source code order. Under this assumption, a first series of test methods populates the database, followed by a series of methods which modifies the data, and finally a series of methods which deletes the data.

Making this assumption was fine until upgrading to Java 7. The new implementation of the reflection API differs from its predecessors in such a way that JUnit now executes test methods in seemingly random order. This wreaks havoc when the order of tests is important.

To address this issue the @FixMethodOrder annotation has been introduced in JUnit 4.11. It can be used to force execution of test methods in alphabetical order.

Version 1.1.0 of crnickl-test uses this new annotation and renames some methods so that source order and alphabetical order agree. crnickl-test is a library providing common tests for all database drivers and is used by crnickl-jdbc and crnickl-mongodb.

The software can be found on GitHub and in Maven Central.

CrNiCKL project website

Tuesday, January 22, 2013

CrNiCKL driver for MongoDB released

A CrNiCKL driver for MongoDB was released yesterday. With this first NoSQL driver, developers have now the choice to run CrNiCKL services either on SQL or on NoSQL databases. A NoSQL database can be a good solution for accommodating huge datasets or to address replication or sharding requirements. On the other hand, when data integrity is paramount, it is better to stick with a good old SQL database and use the CrNiCKL driver for JDBC.

The drivers can be found on GitHub and in Maven Central.

CrNiCKL project website

Saturday, September 8, 2012

The Time2 Library and CrNiCKL now in Maven Central

The projects artifacts are now deployed to Maven Central. It is not necessary to specify a repository in the settings or POM files any more. Using this software with maven is now 100% straightforward.

Time2 Library
CrNiCKL database

Thursday, September 6, 2012

Is it broke? Can we fix it?

This is an update to a post from last year. The post itself has not been updated. You can find the complete article on agent.ch.

Experts met on January 19, 2012 at the International Telecommunication Union to decide whether to abolish leap seconds. Due to a lack of consensus among participants it was decided to postpone the decision (BBC News). It was a classical standoff between those who want sharp, systematic solutions and the advocates of if it ain't broke, don't fix it. A few months later, on June 30, 2012, yet another leap second was added, causing problems at some websites. Wired reported it under the dramatic sounding heading The Inside Story of the Extra Second That Crashed the Web. The discussion is open: is it broke? Can we fix it?

Wednesday, August 29, 2012

The Time2 Library and CrNiCKL support Maven

Yesterday, I moved some of my Java projects to Maven. There is no difference from a client point of view. The new JARs are plug-compatible but not identical, so checksums have changed. This is the only reason why minor version numbers have been +=1d.

The software is not yet available from The Central Repository, but can be found in a freely accessible maven repository on GitHub. To use it, specify this in your POM or settings:

<repository>
  <id>jpvetterli on github.com</id>
  <url>https://raw.github.com/jpvetterli/maven-repo/master/releases/</url>
</repository>
Links:
Time2 Library project
CrNiCKL database project

Tuesday, July 17, 2012

CrNiCKL 1.1.0 released with all delete methods renamed

There were quite a few methods named delete in the CrNiCKL software. This was a bad idea because such methods are useless when called from JavaScript. Indeed, delete is a reserved word in js.

All such methods have been renamed and a new version of the software has been released to the project website, to SourceForge and the GitHub repositories. The following scheme has been used for renaming. Parameterless delete methods are now named destroy. The others are now typically named deleteFoo where Foo is the type of (one of) the parameter(s).

I decided to completely eliminate the old methods rather than let them live a bit longer as deprecated. I did it because the software is not yet used out there. In case I misread the stats, please accept my apologies. In any case the previous version remains available on all the websites mentioned.