Shutting down a JVM process gracefully

Everit - OpenSource

During the development of eosgi-e4-plugin, the following question was raised: How can we shut down the started OSGi container in the way that shutdown hooks are called?

I did a lot of searching, but could not find a satisfiable solution. Let’s see what I have found.

Executing kill command

There is the option to call kill command on Unix systems and send SIGINT or SIGTERM to the JVM. The problems with this:

  • I do not want to execute one more process just to kill another one if not necessary
  • There is no such command on Windows. There is no command in windows that can send SIGINT or SIGTERM to a process

Using JNA and Native calls

Another option is to use JNA. This works pretty well in Linux, but Windows is still a problem. One can call WM_CLOSE on every window of an application or send a Ctrl+C event to the console…

View original post 241 more words

Advertisements

To sort members or not to sort members?

In the last couple of years, I developed all of my codes in the way that all members and statics of every class were sorted by Eclipse. I recently joined a new project and it was surprising to me how much the other members of the team were against sorting the members. As always, I tried to understand their motivation and find the differences in our opinions.

Their main reason was the following:

I want to put the functions and variables that belong together next to each other, so I can see them together.

I saw their point. However, I did not agree with it and I could not convince them about my right. I told them:

If you used Git and code review before accepting pull requests, you would find it very annoying if non-fucntional code changes would divert your attention. By non-functional, I mean changing the order of functions or doing some code formatting.

That was not enough. How do you explain the benefit of code reviews and the drawbacks of non-functional changes in the code to someone, who has never used Git neither code reviews?

I still felt that there was something else, too. What did I miss in the argument? Why do I not care if the functions that are called from each other are not close to each other in the source code?

You can call me uppish, but in every development team in my life, I was much faster at code investigation than others. It had one reason. While the other programmers started to analyze the code as a book, I wanted to know only what I had to.

Imagine you are looking for the reason why a label has a specific value on the screen. While the others see the code snippet below:

full_source

I see only the following:

cropped_source.png

You see the difference? I care only about the code I need to know. After I find this code snippet, I will push CTRL+ALT+H to see where the current function is called from. I do not care if the caller function is before or behind this one. I will jump there and continue my investigation.

I look around myself, and see that most of the developers do not even know the most basic keyboard shortcuts of Eclipse:

  • CTRL+SHIFT+T: Open a type
  • F3: jump to definition
  • CTRL+T: Type hierarchy in a pop-up. This is very useful during an investigation if we want to know where a method of an interface is implemented.
  • CTRL+ALT+H: Call hierarchy. Where is this variable used or where is this method called from?
  • CTRL+L: Jump to line. Very useful if we have a stacktrace and we want to start investigating the issue by line number.

I might have missed a couple of useful shortcut keys. What I wanted to express is that the ones who do code investigations without these, cannot call them experts. Their effectivity is way beyond the ones who know the tricks.

As soon as you start reading the code effectively, you will not care about the grouping of variables and functions at all. However, it will be very annoying if you see that others spend much energy on grouping, instead of concentrating on the business logic they want to implement. If you start thinking of grouping, you waste time and effectivity. You will never be as effective as others.

So why do I care about sorting the members at all? Why should I sort the members if it does not matter during code investigation? Because I want to make only those changes visible in my commits that have actual functional meaning. Without automated-sorting and very strict automated code-formatting in my IDE, I should spend a high amount of energy on reviewing my own commits before pushing them for code review.

Everit Blobstore release 1.0

Everit - OpenSource

We are happy to announce the first public release of Blobstore components. Blobstore allows the programmer to read and write binary large objects within atomic transactions.

Everit Blobstore has in-memory and JDBC-based implementations. While the in-memory implementation can be used to write unit tests, the other one supports several relational database types: Apache Derby, Hsqldb, MySQL, PostgreSQL, Microsoft SQLServer, Oracle

As always, the artifacts are available on maven-central.

For more information, see the site of Blobstore: http://www.everit.org/blobstore.html

View original post

Everit Component Model 1.0.0 release

Everit - OpenSource

After lots of work, ECM (Everit Component Model) is finally released. In the scope of the project several modules were developed:

View original post 187 more words

Configuration chapter of Everit Cookbook is available

The Configuration chapter of Everit Cookbook is available. This chapter gives a step-by-step guide of:

  • Installing Jetty with WebConsole
  • Creating configuration for components
  • Persist the configuration in the way that it is available during the build on the CI server as well

Everit Authorization 1.0.0

I am happy to announce that the first stable modules of Everit Authorization is uploaded to maven-central.

The implementation is based on the concept of modularized persistence.

The modules are tested on H2, Mysql and PostgreSQL.

The documentation is available in the README file of the reference implementaiton and in the javadoc of the interfaces. 

New releases for Everit Persistence

Code generation improvements

lqmg-maven-plugin 3.0 with osgi-lqmg is released with the following features:

  • Property renaming possibility in lqmg xml files
  • schema name is generated into metadata classes
  • schema parameter is renamed to be capability
  • unsatisfied wires can be modified to be optional during code generation (hackWires)

New components

  • osgi-querydsl-configuration: Register Querydsl Configuration instances as OSGi services easily
  • osgi-querydsl-support: Use database connections and Configuration instances via functional interfaces and avoid the overhead of handling SQLExceptions