Archives de l’auteur : davidhxxx

HashMap and ConcurrentHashMap Microbenchmark

Is ConcurrentHashMap always faster than HashMap for concurrent access ? If the map is accessible by concurrent threads, ConcurrentHashMap without additional synchronization mechanisms is often enough for reading operations. We may have some delay in the returned values by the … Continuer la lecture

Publié dans benchmark, java, map, microbenchmark, performance en JAVA | Marqué avec | Laisser un commentaire

JMX command line

jmxterm tool (command line tool) Run the command line program : java -jar jmxterm-1.0.0-uber.jar Useful args : -l  host:port to specify a remote jmx connection -u foo -p pass  to specify the jmx user/password Commands :  Open a JMX session : open … Continuer la lecture

Publié dans Non classé | Laisser un commentaire

Design Pattern : visitor implementation in Java

The source code of design patterns can be viewed and downloaded here : https://github.com/ebundy/java-examples/tree/master/design-patternsWhat is it ?The visitor design pattern is a behavioral pattern.The pattern splits the model data and its operations in distinct structures.When using it ?Multiple reasons :1) … Continuer la lecture

Publié dans Non classé | Laisser un commentaire

NPM

Install Node/Npm On linux : yum/apt install nodejs Important points about node install on Linux : – npm is also installed when nodejs is installed. – during the install, a /usr/bin/npm symbolic link is added and that points to ../lib/node_modules/npm/bin/npm-cli.js … Continuer la lecture

Publié dans Non classé | Laisser un commentaire

My everyday GIT commands

Themes Definitions Git ignore Company proxy tricks Minimal config variable to set to work in good conditions Clone repositories Git init repositories Partial clone and partial checkout Manage Branches (list, deletion, creation) Update Local projects Rebase Merge Git status Git … Continuer la lecture

Publié dans Non classé | Laisser un commentaire

Java 8 Method references or how to shorten lambdas that invoke just one method

There are 3 categories of lambda expression that we could convert to method references. All of these consist of a single method invocation. 1) Invoking an instance method on the first argument of the lambda 2) Invoking a static method on … Continuer la lecture

Publié dans java, java 8, java8, lambda | Laisser un commentaire

Java 8 Lambda expressions or how to write a better quality code

Lambda that relies mainly on the Java 8 functional interface concept has two faces :– it is really necessary to use streams that were also introduced in Java 8– beyond this use with streams, it is also a excellent language … Continuer la lecture

Publié dans anonymous class, java, java 8, java8, lambda | Laisser un commentaire

Java Generics

Java generics present many specificities. Here these I frequently rely on and that I consider as an unavoidable requirement to understand and work with generics.   I will illustrate these points by  endeavoring to stay as general as possible about the … Continuer la lecture

Publié dans Non classé | Laisser un commentaire

Tips and tools to analyse JVM

How to know the memory allocated to the JVM by default (XMS and XMX) ? It depends on the Java version. On JVM 8 : Xms = 1/64 of the physical memory on the machine. Xmx = 1/4 of the … Continuer la lecture

Publié dans Non classé | Laisser un commentaire

Java 8 Predicates or how to parameterize a method with a boolean-valued function

Plan Before Java 8, we cannot pass a boolean-valued function/method as argument to another method : example of use case, consequences and workarounds How Java 8 addresses the need of passing a boolean-valued function/method as argument to another method ? We will … Continuer la lecture

Publié dans java, java 8, java8 | Un commentaire