Here you can find the source of getContext(Class> c)
private static JAXBContext getContext(Class<?> c) throws JAXBException
//package com.java2s; //## The MIT License import java.util.concurrent.ConcurrentHashMap; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; public class Main { private static ConcurrentHashMap<Class<?>, JAXBContext> contextMap = new ConcurrentHashMap<Class<?>, JAXBContext>(); private static JAXBContext getContext(Class<?> c) throws JAXBException { JAXBContext jc = contextMap.get(c); if (jc == null) { jc = JAXBContext.newInstance(c); contextMap.put(c, jc);/*ww w. ja va 2 s . c o m*/ } return jc; } }