Home » Author Archives: Tomasz Nurkiewicz (page 9)

Author Archives: Tomasz Nurkiewicz

Java EE developer, Scala enthusiast. Enjoying data analysis and visualization. Strongly believes in the power of testing and automation.

RateLimiter – discovering Google Guava

google-logo

RateLimiter class was recently added to Guava libraries (since 13.0) and it is already among my favourite tools. Have a look what the JavaDoc says: Let’s start from a simple example. Say we have a long running process that needs to broadcast its progress to supplied listener: def longRunning(listener: Listener) { var processed = 0 for(item <- items) { //..do ...

Read More »

Which Java thread consumes my CPU?

java-logo

What do you do when your Java application consumes 100% of the CPU? Turns out you can easily find the problematic thread(s) using built-in UNIX and JDK tools. No profilers or agents required. For the purpose of testing we’ll use this simple program: public class Main { public static void main(String[] args) { new Thread(new Idle(), 'Idle').start(); new Thread(new Busy(), ...

Read More »

String memory internals

java-logo

This article is based on my answer on StackOverflow. I am trying to explain how String class stores the texts, how interning and constant pool works. The main point to understand here is the distinction between String Java object and its contents – char[] under private value field. String is basically a wrapper around char[] array, encapsulating it and making ...

Read More »

ServletRequest startAsync() limited usefulness

java-interview-questions-answers

Some time ago I came across What’s the purpose of AsyncContext.start(…) in Servlet 3.0? question. Quoting the Javadoc of aforementioned method: Causes the container to dispatch a thread, possibly from a managed thread pool, to run the specified Runnable. To remind all of you, AsyncContext is a standard way defined in Servlet 3.0 specification to handle HTTP requests asynchronously. Basically ...

Read More »

Spring Integration with reCAPTCHA

spring-interview-questions-answers

Sometimes we just need CAPTCHA, that’s a sad fact. Today we will learn how to integrate with reCAPTCHA. Because the topic itself isn’t particularly interesting and advanced, we will overengineer a bit (?) by using Spring Integration to handle low-level details. The decision to use reCAPTCHA by Google was dictated by two factors: (1) it is a moderately good CAPTCHA ...

Read More »

Quartz scheduler misfire instructions explained

quartz-scheduler-logo

Sometimes Quartz is not capable of running your job at the time when you desired. There are three reasons for that: all worker threads were busy running other jobs (probably with higher priority) the scheduler itself was down the job was scheduled with start time in the past (probably a coding error) You can increase the number of worker threads ...

Read More »

Quartz scheduler plugins – hidden treasure

quartz-scheduler-logo

Although briefly described in the official documentation, I believe Quartz plugins aren’t known enough, looking at how useful they are. Essentially plugins in Quartz are convenient classes wrapping registration of underlying listeners. You are free to write your own plugins but we will focus on existing ones shipped with Quartz. LoggingTriggerHistoryPlugin First some background. Two main abstractions in Quartz are ...

Read More »

Configuring Quartz with JDBCJobStore in Spring

quartz-scheduler-logo

I am starting a little series about Quartz scheduler internals, tips and tricks, this is a chapter 0 – how to configure persistent job store. In Quartz you essentially have a choice between storing jobs and triggers in memory and in a relation database ( Terracotta is a recent addition to the mix). I would say in 90% of the ...

Read More »

Filter irrelevant stack trace lines in logs

logback-logo

I love stack traces. Not because I love errors, but the moment they occur, stack trace is priceless source of information. For instance in web application the stack trace shows you the complete request processing path, from HTTP socket, through filters, servlets, controllers, services, DAOs, etc. – up to the place, where an error occurred. You can read them as ...

Read More »

Client-side server monitoring with Jolokia and JMX

jolokia-logo

The choice of Java monitoring tools is tremendous (random selection and order powered by Google): javamelody psi-probe JVisualVM jconsole JAMon Java JMX Nagios Plugin N/A Besides, there are various dedicated tools e.g. for ActiveMQ, JBoss, Quartz scheduler, Tomcat/tcServer… So which one should you use as an ultimate monitoring dashboard? Well, none of them provide out-of-the-box features you might require. In ...

Read More »
Do you want to know how to develop your skillset and become a ...

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!
Get ready to Rock!
To download the books, please verify your email address by following the instructions found on the email we just sent you.

THANK YOU!

Close