SSH Tunneling diagram

SSH Tunnelling with Java

You heave a sigh of relief, as the QA has approved a long-awaited feature for deployment on Prod. However, as a part of the process, it is first deployed on the UAT env, where there are test accounts that can be used to certify the feature works outside of the local developer and QA testing systems. ...

September 21, 2024 · 4 min

Dynamic Enums

But can one even make Enums dynamic? Enums, by definition, are static. They are used to “predefine” constants. I’ll let the official Oracle Java Tutorial on Enums to help explain the definition. ...

July 3, 2021 · 17 min

The Java Constants Interface Anti-Pattern

How do you define and use constants in Java? Most advice on Internet has the following opinions: Declare public static final for constants in a class Do not use Interfaces for constants The most common way to define a constant is in a class and using public static final. One can then use the constant in another class using ClassName.CONSTANT_NAME. Constants are usually defined in upper cases as a rule, atleast in Java. ...

November 8, 2020 · 5 min

How to change Java Version/JAVA_HOME for Ant?

I wrote this earlier on a Github gist, but putting it here for a consolidated reference. Want to change Java Version/JAVA_HOME for Ant builds? Open ~/.antrc file by running vim ~/.antrc Add JAVACMD=<NEW_JAVA_HOME>/bin/java and save The Ant wrapper script for Unix will source (read and evaluate) the file ~/.antrc before it does anything. On Windows, the Ant wrapper batch-file invokes %HOME%\antrc_pre.bat at the start and %HOME%\antrc_post.bat at the end. You can use these files, for example, to set/unset environment variables that should only be visible during the execution of Ant. ...

June 15, 2020 · 1 min

How to achieve a 50% reduction in Redis memory usage

Yes, you read that right. To give you some context, some time ago, our (my org’s) Redis usage was un-tracked – meaning we didn’t know why our Redis memory was being occupied as much as it was. Our 2.5GB of Redis ElastiCache was almost close to being full, and if it somehow reached its limit, our system would start to fail. Though there were fallbacks in place, Redis could turn out to be a bottle-neck. ...

May 10, 2020 · 11 min