Java Dynamic Proxy

Dynamic proxying is used widely in the frameworks, so a basic understanding of the implementation can be helpfull to use those frameworks. Of course, there can be a situation where a dynamic proxy implementation can be a good choice. Here a simple example of a dynamic proxy implementation using Java 8       If … More Java Dynamic Proxy

Dynamicaly Injecting Logger class

On the following way, it is possible to inject a logger class using CDI bean. … package com.ardevco import org.apache.log4j.Logger; public class LoggerProducer { @Produces public Logger produceLogger(InjectionPoint injectionPoint) { return Logger.getLogger(injectionPoint.getMember.getDeclaringClass.getName()); } } … Usage: @Inject private transient Logger logger; Another way is injecting the Level as well: @Produces public Consumer<String> produceInfoLoggerInjectionPoint injectionPoint) { … More Dynamicaly Injecting Logger class

Implementing timeout for a synchronous method

Sometimes, a java call blocks forever. This may cause serious problems like blokking processing or stuck threads. In these cases, you can choose to set a timeout to break the execution and eventually roll back the transaction. To call a Java synchronous method with a timeout, you can use Executorservice as showed below. package com.nuon.infostroom.process; … More Implementing timeout for a synchronous method

How-to make Thread dump of Java and Weblogic Server

There are several ways to make a thread dump. Below a list of possible ways to to it: Option 1: Log in on the console Log into the console Go to Environment/Servers/[server]/Server Start Insert the following line to the “Arguments”: Save and activate the session [server] -> The server for which you want to make … More How-to make Thread dump of Java and Weblogic Server