header-img
Solarwind OBS
Personal Home Page of Zhongyang MA
RSS Feed

Articles

  • The Principle Of MySQL Index

    Recent days, I read a very excellent overview article, which gives us a deep insight about the algorithm and data structure behind MySQL index. Thanks to the author for introducing us about the index mechanism of database system. In this post, I recorded down the key information of the author’s article for further review.

    Read More »

  • Spring AOP With AspectJ

    One of the key components of Spring Framework is the Aspect oriented programming (AOP) framework. The functions that span multiple points of an application are called cross-cutting concerns and these cross-cutting concerns are conceptually separate from the application’s business logic. AspectJ is one of the most well-known implementations for AOP in Java. In this article we will concentrate on AspectJ’s implementation of AOP and how it works in Java.

    Read More »

  • Java Annotations

    Annotations have been around since Java 5, and nowadays, they are ubiquitous programming constructs that allow enriching the code. In this article, we’ll review some of the annotations questions that are often asked on technical interviews.

    Read More »

  • Java Thread Pool Executor

    In Java, threads are mapped to system-level threads which are operating system’s resources. If you create threads uncontrollably, you may run out of these resources quickly. The Thread Pool pattern helps to save resources in a multi-threaded application, and also to contain the parallelism in certain predefined limits. When you use a thread pool, you write your concurrent code in the form of parallel tasks and submit them for execution to an instance of a thread pool. This instance controls several re-used threads for executing these tasks.

    Read More »

  • Some Points To Remember About Thread In Java

    Thread is a smallest executable unit of a process. Thread has it’s own path of execution in a process. Multitasking is an operation in which multiple tasks are performed simultaneously. Multitasking is used to utilize CPU’s idle time. In thread-based multitasking or multithreading, multiple threads in a process are executed simultaneously. In this reading note, I just record down some basic points to remember about thread in Java.

    Read More »

  • ReentrantLock vs. synchronized

    Lock provides a tool to control access to a shared resource in a multi-threaded environment. A lock provides access to only one thread at a time to the shared resource. Before Java 5.0, the only mechanisms for coordinating access to shared data were synchronized and volatile. Java 5.0 adds another option: ReentrantLock. ReentrantLock is a mutual exclusion lock similar to implicit lock provided by synchronized methods and statements but with additional flexibility. It is not a replacement for intrinsic locking, but rather an alternative with advanced features.

    Read More »

  • Vector, ArrayList and LinkedList

    An ordered or sequential collection of objects can be represented by the List interface, which has a set of methods to store and manipulate the ordered collection of objects. ArrayList, Vector and LinkedList are some examples of List implementations. Lists allow us to insert or remove an element at any specific index. In this reading note, I will make a brief introduction to and comparison between Vector, ArrayList and LinkedList.

    Read More »

  • Maps In Java

    Map is a data structure and it is mainly used for fast data lookups or searching. The Map interface in java is one of the four top level interfaces of Java Collection Framework along with ListSet and Queue interfaces. But, unlike others, it doesn’t inherit from Collection interface. Instead it starts its own interface hierarchy for maintaining the key-value associations. Map is an object of key-value pairs where each key is associated with a value. HashMapLinkedHashMap, ConcurrentHashMap and TreeMap are four popular implementations of Map interface. In this article, we will discuss about the hierarchy, property and internal mechanisms of Map in Java.

    Read More »

  • Internal Caching Of Wrapper Classes

    I first realized this mechanism at the time when I read an interview question about the equality checking of two Integer values. As we all know, a new instance created in java takes some memory space in heap, so creating new objects is always an expensive process. To avoid this expensive object creation process, many frameworks have provided resource pooling in different ways. In Java, wrapper classes are immutable, each wrapper class stores a list of commonly used instances of its own type in form of cache. Just like string pool, they can also have their own pools.

    Read More »

  • Auto-Widening, Auto-Boxing and Auto-UpCasting

    This is an quite interesting topic in Java. Before I wrote this reading note I can not exactly distinguish them one from another. So let’s see what auto-widening, auto-boxing and auto-upcasting mean, and under what circumstances they will happen.

    Read More »