imsavva.com

Folder icon

Coding

1Z0-808
ATG
Apache Fop
Elasticsearch
GWT
Groovy
JPA
Java
JavaScript
Jetty
Kibana
OCA
PDF
collections
concurrency
dates
dig deeper
exceptions
games
interview questions
logging
patterns
task
1
2
3
4
5
6

Using StringBuilder instead of usual concatenation. When is it appropriate?

showPostImage(1943353928)

Uncaught exception: the image is currently being shown in a museum

You might know that using string concatenation in Java is not a good practice as it might affect performance. In this short article, I will try to describe when it is necessary to use StringBuilder and when we can afford using concatenation (+ sign). Let's start with a simple example: To see how it works under the hood…
Posted on
2017-12-21

My plans for the future

Update 06.02.2021: still getting there and changing my plans according to the situation :)
Posted on
2017-08-16

Logging in ATG: how to send error reports to Elasticsearch and display them with Kibana

In this article, I'm going to share my experience with Oracle ATG logging system and such great tools like Elasticsearch and Kibana. Imagine that we have a big ATG-based project and our task is to store and list all the users who met (explicitly or not) errors. To solve this task we will add a new event listener to…
Posted on
2017-07-13

Using one DateFormat instance per thread with ThreadLocal

Here is a quick tip how to use DateFormat inside a ThreadLocal field. Why do we need that? The reason is the DateFormat class is not thread-safe but creating its instances is an expensive operation. So, this is kind of a workaround that creates only one instance of DateFormat per thread.
Posted on
2017-07-12

UnhandledExceptionHandler in Java: how to catch uncaught exceptions

In this short tutorial, I'm going to describe how to handle uncaught exceptions in threads. This can be done by: Using threadInstance.setUncaughtExceptionHandler() ─ for a specific thread Overriding ThreadGroup's uncaughtException() method ─ for a thread group Using Thread.setDefaultUncaughtExceptionHandler() ─ for all…
Posted on
2017-07-05

How to lookup a user profile from a global-scoped ATG component

This article describes how to look up a session-scoped user profile component from a global scope component that has no access to a DynamoHttpServletRequest object. To achieve this functionality, we will use a ThreadLocal field an ATG feature called Insertable Servlet . When a request object is created, it goes…
Posted on
2017-06-30

How to run a Groovy script from Java

showPostImage(984496268)

Uncaught exception: the image was stolen by a UFO

One of the ways of running a Groovy script from Java is using GroovieShell. First, add the groovy-all Maven dependency (consider using a fresher version): Next, create a class containing the main method. The Binding instance helps us to bind variables to the shell. These variables will be available for our script. We…
Posted on
2017-03-01
1
2
3
4
5
6
Do I really need the footer?