Send Us Your Best Java Hacks and Win a Kano Computer

 ● 23rd Oct 2014

4 min read

What are the most extraordinary pieces of Java code you’ve had the chance to write? Share your story and win a Kano – A Raspberry pi DIY computer kit

Having so much Java code written every day can produce quite a lot of quirks and trouble. It can make you laugh, it can make you cry, but when it finally works it sometimes feels like magic. In this post we’re looking hear your stories from the trenches of your IDE: What’s the most useful debugging trick you use? What are some of the things you do that most developers aren’t aware of? How did you manage to solve that issue that was bugging you for way too long?

Share your Java war stories with us and win a Kano computer kit

– We’ll go over the stories and select the ones we feel are the most creative, interesting and smart.
– The submissions we like most will be published on the OverOps blog, reaching tens of thousands of developers.
– If we decide to publish your story, you will be contacted to provide a few extra details for the post – And win a Kano kit worth $150.
– Code samples are strongly encouraged (please make sure it’s ok for us to use them in the post).
– Submit your story using the form below or through email: hacks@overops.com.
Kano box The Kano DIY computer kit
Kano is a Raspberry Pi based computer that you make yourself (a Raspberry Pi can also runs Java by the way, so you can keep hacking on other devices as well). We’ll contact a few selected participants and keep it rolling from there – please elaborate as much as you can and don’t forget to include relevant code samples.

What makes a good submission?

On our previous posts we’ve shared some of the things we learned in OverOps like reducing GC overhead, Logback tweaks, and most recently, debugging with jstack. jstack is a lightweight tool that shows the stack traces of all Java threads running within a target JVM just by pointing it to a process via pid. With a few more tweaks described in the post, you will be able to add extra thread state data like its purpose and transaction IDs for example. In addition, although traditionally its a standalone tool, we describe how you can invoke it programmatically whenever a custom condition you define happens (like a throughput decrease for example):
[java]
public void startScheduleTask() {
scheduler.scheduleAtFixedRate(new Runnable() {
public void run() {
checkThroughput();
}
}, APP_WARMUP, POLLING_CYCLE, TimeUnit.SECONDS);
}
private void checkThroughput()
{
int throughput = adder.intValue(); //the adder in inc’d when a message is processed
if (throughput < MIN_THROUGHPUT) {
Thread.currentThread().setName(“Throughput jstack thread: ” + throughput);
System.err.println(“Minimal throughput failed: exexuting jstack”);
executeJstack(); //see the code on github to see how this is done
}
adder.reset();
}
[/java]
The full code samples are available on GitHub.
Another cool example we ran into comes from Siddharth Anand on Quora. Have you ever heard about thread migration from machine to machine? Because that’s exactly what Siddarth was experiencing when he implemented a server using RMI (Remote Method Invocation). Due to a bug, the RMI server returned the thread itself instead of returning the result of its computation. This means the thread started on the server machine, serialized over the network, and completed its execution on the client machine – resulting in threads that do machine travel, whoa. This bug was identified and fixed by printing out some debug messages which then were printed both to the server and to the client after the thread jumped over the network.
(edit: Just had to squeeze this one in, a Java multiline string implementation using comments & annotations. Mind. Blown: https://github.com/benelog/multiline/)

Here’s a template to make your submission easier, you can either use the form or send us an email to hacks@overops.com:

** Can’t see the questions? Click here
** Answers can also be sent by email to hacks@overops.com

5 Error Tracking Tools Java Developers Should Know
Read more
blog_error

Alex is the Director of Product Marketing at OverOps. As an engineer-turned-marketer, he is passionate about transforming complex topics into simple narratives and using his experience to help software engineering navigate their way through the crowded DevOps landscape.

Troubleshooting Apache Spark Applications with OverOps OverOps’ ability to detect precisely why something broke and to see variable state is invaluable in a distributed compute environment.
Troubleshooting Apache Spark Applications with OverOps

Next Article

The Fastest Way to Why.

Eliminate the detective work of searching logs for the Cause of critical issues. Resolve issues in minutes.
Learn More