Making the bootstrap loader "just another ClassLoader"

Recently, I was tweaking MultiSPI to add the following class loading fallback logic:

if (threadContextLoader != null) {
} else if (systemLoader != null) {
} else {

and realized that it's not immediately evident how to do this in a uniform way. But actually, it's quite simple...getting a ClassLoader object for the bootstrap loader is just a couple of lines of code.
Read more →

MultiSPI - consuming service provider interfaces in 2011

Implementing a Java SPI isn't a particularly 2011 experience1. Creating a correctly-named text file in META-INF/services, making sure it is correctly packaged and remembering to keep it up to date when you refactor is sufficiently annoying and error-prone that there are at least a couple of utils that aim to make this easier.

At XebiaLabs, however, we're not just the implementors of our plugin SPI. We also write the deployment engine that consumes these plugins. And unfortunately, there isn't much out there to help you read, load and verify services. Hence MultiSPI.
Read more →

Embracing Downtime: Why 99.999...% Availability is Not Always Better

A couple of weeks ago, my ever-active colleagues Marco Mulder and Serge Beaumont organised an nlscrum meetup about "Combining Scrum and Operations", with presentations by Jeroen Bekaert and devopsdays organiser Patrick Debois.

Unfortunately, I was late and only managed to catch the tail end of Patrick's well-delivered talk explaining how Dev/ops can become Devops. Thankfully, the lively open space discussions that followed provided plenty of interesting insights, comments and general food for thought.

One recurring theme that particularly struck me was the comment, uttered with regret by many in Operations, that they would very much like to help and coordinate with the development teams but inevitably were always too busy keeping the production environment up and running.
In other words, helping prepare for new releases might be desirable, but achieving the five nines, or whatever SLA Operations has committed to1, will always be paramount.

This is a fallacy! Indeed, one of the core realisations of the "Devops mindset", to me, is that 99.999...% uptime is not an end in itself, but a means to an end: delivering the greatest business value possible. And aiming for the highest possible availability may not be the best way to go about it!2

Read more →

Customize This: Tailoring deployment packages to your target environments

Sometime in the bright future, you will be able to deploy the same virtual appliance containing your application to all your target environments without adjustments. For the time being, however, deployments to traditional DTAP1 landscapes almost always mean "tweaking" the application and associated configuration and resources to match the target environment - think endpoints, properties files or datasource usernames and passwords, to name but a few.

In the absence of any established standards or even guidelines in this area, many different solutions to this problem of deployment package customization have been employed, from fairly elegant approaches such as JMX to crude string search-and-replace.
Furthermore, different types of middleware platforms have varying degrees of support for customizations: typically, portals, ESBs and process servers offer some "native" solution to the problem, whereas application servers tend to leave users to fend for themselves.

More often than not, the result is a chaotic mix of customization approaches across projects, target platforms and departments2. Here, we'll look at some of these approaches, classify them and examine some drawbacks and benefits.Read more →

Developing and deploying Java on middleware and in the cloud: rise of the Virtual Appliance?

From Java EE to Google App Engine to GigaSpaces, the idea of developing against a middleware or "infrastructure" API is well established in the Java world.
But these are fixed environments. With the (re-)advent of virtualization, it is now becoming feasible to package and rapidly provision your own environment, custom-designed to meet your application's needs.
As the big middleware vendors are realizing, it is not just possible to create such Virtual Appliances, but necessary: a production app's setup inevitably includes more than just a couple of EARs.

Here, we'll look at the current state of cloud and middleware deployment tooling, examine possible future developments and draw parallels between deployment and related processes.
Read more →

Implementing Deployit, part 2: technical considerations

In a recent post, XebiaLabs' CTO Vincent Partington discussed some important organizational topics you will want to address while introducing deployment automation using Deployit.
Preparing your organization is, of course, crucial to getting maximum possible benefits from deployment automation. A few technical considerations also apply when introducing Deployit, and here we'd like to go into these so that you can be sure your infrastructure is ready when it comes to carrying out your first fully automated deployment.
Read more →

Mocking the 'unmockable': too much of a good thing?

Static calls, final classes, objects created in test code: there are few things some of the current mocking frameworks cannot handle. Using powerful approaches like bytecode instrumentation or custom class loaders, these libraries make code that was previously a 'no go' area amenable to unit testing. This, moreover, in an elegant and convenient manner that will feel familiar to developers used to 'standard' mocking frameworks.
The question is: does such power perhaps come with hidden dangers? Might it be possible that the ability to test more could actually result in less code quality?
Read more →

Testing the testers: code samples from a TDD framework comparison

Some while back I was preparing a presentation on mocking and testing frameworks for Java. As part of the aim was to demonstrate some real, running code, I ended up spending quite some time copying, pasting, extending and correcting various examples gleaned from readmes, Javadoc, Wiki pages and blog posts. Since then, this codebase has been extended with various new features I've come across, and I've often referred to it for experiments, as a helpful reference, and suchlike.

I imagine this kind of "live" reference could also be useful to others, so I thought I'd share it.Read more →