Tillmann Seidel
Mutable variable capture in anonymous Java classes
The Java compiler requires local variables of enclosing contexts referenced in anonymous classes (so-called captured variables) to be final. What if the anonymous class wants to alter the value of the variable, i.e. requires the variable to be mutable? This post shows different ways how to achieve that.
UTF-8 RAP I18N
I always wanted to write a blog post with a title consisting of just acronyms and numeronyms - here it is!
Using EasyMock class extensions in Eclipse PDE tests
EasyMock is a powerful framework to create mock objects to use in Java JUnit tests. When used in an OSGi environment (e.g. to write Eclipse PDE tests), the creation of class extensions can cause trouble. This post describes a problematic use case and possible solutions.
Running Eclipse applications on Windows 8
Reading the title, you might ask why this could be a problem. Good news: in most cases it isn’t. However it can be problem if you use native code in your Eclipse plug-in and run on an older version of Equinox (3.7.2 and earlier). This post describes the problem and possible solutions.
Use your HEAD - checking CouchDB document existence
One common task when working with CouchDB is to find out whether a document with a given ID exists. A simple solution is to send an HTTP GET request with the ID to CouchDB and check the response’s HTTP status code.
Creating Tomcat heap dumps on Windows
One option for detecting memory leaks in Java is the analysis of heap dumps. The first step is to create an HPROF heap dump from the running Java application, the second is the analysis of the dump with an appropriate analysis tool like jvisualvm or Eclipse Memory Analyzer (MAT). Wanting to do the first step for a running Apache Tomcat on Windows, I found that creating the dump is not as trivial as it seems, especially if Tomcat is run as a windows service. This post is a description of my experience with three tools available with the JDK.
Finding the right OSGi services using the objectclass property
Recently I wanted to use the good old ServiceTracker to get access to OSGi services registered under a specific interface and matching a given filter. I was surprised to discover that there is no constructor for the ServiceTracker
that allows the specification of a class name and a filter.
Filtering tables in SWT/JFace
Working with tables or trees with more than a handful of rows, you quickly find that you need a way to filter or search for content, otherwise they become unusable. The Eclipse workbench offers an out-of-the-box component named FilteredTree which adds an input field to an SWT tree where filter strings can be entered by the user. However, support for SWT tables is missing. This post shows how filter support can be added to tables using the existing capabilities in the workbench.
Sorting out listener implementations in Java
Recently I scanned the source code of our current Eclipse RCP/RAP project for occurrences of the Listener (or Observer) pattern. I found no less than 6 (!) different implementations and decided to unify them into one. When researching the implementation options (and the Java world has many to offer), I found an aspect of Listener programming that is usually not mentioned by internet resources. But first, let’s look at the options.
Improving reuse of JFace Data Binding validators
JFace Data Binding allows you to attach only one validator to a binding. Putting all constraints into one validator is essentially bad design and compromises reusability. Here’s a trick for dealing with this limitation of the data binding API and at the same time, keeping your validators small and reusable.
Reducing CouchDB disk space consumption
Apache CouchDB offers high availability, excellent throughput and scalability. These goals were achieved using immutable data structures - but they have a price: disk space. CouchDB was designed under the assumption that disk space is cheap. Though it is indeed getting cheaper and cheaper, it is not infinite. Here’s a tip to reduce CouchDB database files’ disk consumption.
Using the Whiteboard Pattern with RAP
When adopting the Whiteboard Pattern for one of our Eclipse RAP based web applications, we stumbled upon a problem concerning the session scope of events. Here’s how we solved it.