A challenging solution needed

Some years ago I was presented to a project that needed a solution. No news at this point, that is the reality of any IT professional on daily basis.

But then they started talking about the requirements… well, let me show them:

  1. They had a web-based system running in that classical way: a new company pay for using, you install it in some server on their network and everybody inside the company access the system using a web browser (the damn IE);
  2. The system was built in Java 4 and there’s was no chance to upgrade to Java 7 (the latest version that time);
  3. The system was deployed at Tomcat 4 and there’s was no chance to upgrade;
  4. They didn’t use connection pooling for database connection. Worst: each user opens a connection with database when login into the system and that connection was hold into the session. Here they would accept a refactoring, but the whole scenario won’t;
  5. They needed the system to be available online in a SAAS way:
    • Each new user would create its new account online and pay the signature with credit card;
    • The system couldn’t be refactored for avoiding users to see each others data. Talking in another words, a system built for running in one single company at time needed to be available in one single platform, for as many companies as possible at time, protecting the users data as it was supposed to do, and COULD NOT be refactored for it.
  6. The budget for the project was almost zero (no news either);
  7. The deadline was almost instantaneous.

My first reaction was laughing, but then I realized they was talking serious… “Ok, let me think for a day…”

Well in fact it didn’t took me a long time to design the right solution. I have to be honest, it wasn’t the prettiest and neither the coolest solution I had ever did, but was fine for what they needed to do, in the way they wanted to do and spending the much they wanted to spend.

The big challenge: segregate the users data in the same environment with a system that just was not built for it and couldn’t be deeply refactored

(Big subtitle for a big problem)

To solve this challenge I did one thing that solved many challenges in this project: a facade application. The user could not see it, but he/she was in fact using two systems: one, the facade, was responsible for managing the users, grants, profiles, signature status and, more important, the authentication and database redirection; the other one, the old system.

Instead of keeping the database access tied to application configuration files, I moved it to a session variable. So when the facade application did the authentication and found the right database for that user/company, it passed those data to the system (cross context applications) and then it could open its connection and do whatever it needed to do as nothing different was happening.

When a new user registered at the company site, this same facade application started creating that user: registering account, authorizing the payment and… creating the database. Each new user won its own database in the system database server.

So there was a “model” database and each new database was created based on it.

To support it we created five database instances in the database server and created a “manual” round-robin that created each new user in the instance that was less loaded. The facade application was also able to do it in many servers if they were mapped.

So we did a “database load balancing” manually! 😉


Now… everything is just funny

The really big problem was to separate the users data. Once it was done in a skillful way, the rest of the project was the usual stuff: buttons here and there, popups, etc, etc, etc.

The system was deployed in a cloud solution that made the things moving even more faster and cheaper. We probably released the first version in less than a month after the first meeting…


So why the hell I am here sharing this little case. I think we could take some lessons here:

  1. Just because your client is very very very very very restrictive it doesn’t means you can’t find a solution for his/hers problems (even if it sucks…);
  2. The right solution maybe can be the ugly one;
  3. Being creative could save you time, money and headache.


Any comments? Just leave it bellow!



Using Docker to deal with a TomEE missing feature

When I and Bruno Souza were writing the article “Step-by-Step High Availability with Docker and Java EE” we faced a little issue with an Apache TomEE cluster feature: the “hot” deployment thru the cluster nodes isn’t still available, although the configuration at the server.xml is already defined:


The point is: if you deploy a new version of your application in one node, it doesn’t spread thru your entire cluster. At the first moment we look at this as some kind of a tricky situation that we must deal with.

But talking for just a few moments we realized that the article purpose itself was the answer for that issue! How? Simple…

When we create an appliance (for the definition, take a look at the article) we already have the application deployed to our application server. So when we use this appliance to build our cluster (running multiple Docker instances with properly configurations) we don’t need any other deployment at all!

Containers to the rescue! 😉

Think your career and move forward 

Today I will not share any architecture content, but a little career advice.

I’ve been doing what I do for 17 years and, of course, still have a lot to learn. If you think you don’t you surely should change your mind set…

One of the lasts things that I’ve learned is: think your career in a practical way and… take the actions that you are supposed to.

Seems to be obvious but… is it the reality in your career? Wasn’t in mine still some months ago.

We are attracted to some comfort zones and tend to feel relaxed once we find it. Don’t do it! Specially in IT market it is a career suicide.

What I did in the end of last year that are making big changes only six months after is:

  1. Found out where I was in my professional life
  2. Defined some challenging steps to get out of there
  3. Took actions as fast as I could

Guess what: the results are coming faster than I could ever imagine!

Would you try it?

Why getting the Java Enterprise Architect Certification?

Since this year has begun I’ve started my “journey” to the “Oracle Certified Master, Java EE 6 Enterprise Architect“. It’s been fun and either a lot of work to be done (not that I am doing all I’m supposed to do, but…).

Since I decided to do it some people had asked “why do you want this certification?”. Even I asked it for myself so many times… 😉

Well I don’t know if I have a really clear answer to this question as it involves a bunch of things for me, but I’ll try to organize the whole picture.

First of all, after I have attended to JavaOne LA last year I got a scary conclusion: I’ve became obsolete! I was doing good, in a nice job, doing a nice work, with a good salary but… became almost a dinosaur.

Those three awesome days were like a crowbar for my “old” mind (hey I’m not old ok…). I went to all the labs that I could and attended to every single talk that was possible without being omnipresent. I was starving for those informations that I had lost over time.

At end of the final keynote I went home guessing “what should I do now?“. I really needed to do something or my career would collapse in a short time.

Making the long story short I realized that my skills, preferences and experiences were pointing to architecture area. I have worked with it some periods of time and always had a lot of fun. So it was decided: I would do everything to become the best architect that I could be. Period.

The first problem to overcome was that I couldn’t make much progress in this area in the company where I was working. The matter was not the company, but my responsibilities there. So then the “Certification Project” has come.

What was my point? Well if I need to learn and understand a bunch of things to become what I want to become, why not starting by getting “officially” recognized? Mainly due the fact that I couldn’t develop the needed skills where I was working then.

Yeah, I know… getting a certification doesn’t mean you master those skills, but is a very good starting point. And I know it based on my on previous experience.

I’m still on the way to get the certification (my first test will be on May 31th), but I can already identify the benefits for running this run. As I said to some people, the certification is only a excuse to learn somethings that I need and to reach the point that I want.