Pacific-Design.com

    
Home Index

1. Java

+ BerkeleyDB

+ Books

+ Concurrency

+ DateFormat

+ Delete

+ Directories

+ ETL Tables

+ Files

+ JSON

+ Maven

+ MySQL

+ MySQL Single

+ NetBeans

+ Oracle

+ Snippets

+ Spring

+ ThreadLocalRandom

+ YAML

Java /

Java Virtual Machine

                             +-----------+
                             |    JVM    |
                             +-----------+

     +--------------+   +--------------------+   +------------------+  
     | Class Loader |   | Byte Code Verifier |   | Security Manager | 
     +--------------+   +--------------------+   +------------------+ 

             +------------------+      +------------------+
             | Execution Engine |      | Garabe Collector |
             +------------------+      +------------------+
                                        ( Mark and Sweep )
             

JVM Memory

                        +-----------+
                        |    JVM    |
                        +-----------+

      +-------------+                  +-------------+
      |   Stack     |                  |    Heap     |
      +-------------+                  +-------------+
      |   Object    |                  |   ALL New   |
      |  Reference  |----------------->|   Objects   |
      |             |                  |             |
      +-------------+                  +-------------+


Java Just-In-Time compilation

Java Environment

import java.util.Map;

public class Main {

    public static void main(String args[]) throws InterruptedException {

        Map<String, String> env = System.getenv();
        
        for (String envName : env.keySet()) {
            System.out.format("ENV{%s} = %s%n", envName, env.get(envName));
        }
    }
}

Static members are the ones that are associated with the class and not with objects created from the class.

Java - JUnit Framework

package com.myhealthcare.util;                

import java.util.Map;
import junit.framework.Assert;
import org.junit.Test;

public class AppTest {

    @Test
    public void testApp() {

        System.out.println("AppTest:testApp");
        Assert.assertNull(null);
    }   

# Run all test under AppTest class 
$ mvn -Dtest=AppTest test
 
# Run single unit test 
$ mvn -Dtest=AppTest#testApp test

Maven Examples Test


Garbage Collection Tuning

$ jstat -gcutil 21719 1s
S0    S1    E    O    P    YGC    YGCT    FGC    FGCT GCT
48.66 0.00 48.10 49.70 77.45 3428 172.623 3 59.050 231.673
48.66 0.00 48.10 49.70 77.45 3428 172.623 3 59.050 231.673

References:

  1. http://www.java-tips.org/java-se-tips/java.lang/binary-search-tree-implementation-in-java.html
  2. CoderPad.IO - Java programming over HTML
  3. http://www.abilityfirst.co.uk/books