@Override
 @SuppressWarnings("FinalizeDeclaration")
 protected void finalize() throws Throwable {
   try {
     ClassFactory.cleanCache();
   } finally {
     super.finalize();
   }
 }
  public SingleMapNodeProperty(JAXBContextImpl context, RuntimeMapPropertyInfo prop) {
    super(context, prop);
    acc = prop.getAccessor().optimize(context);
    this.tagName = context.nameBuilder.createElementName(prop.getXmlName());
    this.entryTag = context.nameBuilder.createElementName("", "entry");
    this.keyTag = context.nameBuilder.createElementName("", "key");
    this.valueTag = context.nameBuilder.createElementName("", "value");
    this.nillable = prop.isCollectionNillable();
    this.keyBeanInfo = context.getOrCreate(prop.getKeyType());
    this.valueBeanInfo = context.getOrCreate(prop.getValueType());

    // infer the implementation class
    Class<ValueT> sig = ReflectionNavigator.REFLECTION.erasure(prop.getRawType());
    mapImplClass = ClassFactory.inferImplClass(sig, knownImplClasses);
    // TODO: error check for mapImplClass==null
    // what is the error reporting path for this part of the code?
  }
 @Override
 public void startElement(UnmarshallingContext.State state, TagName ea) throws SAXException {
   // create or obtain the Map object
   try {
     target = (BeanT) state.prev.target;
     map = acc.get(target);
     if (map == null) {
       map = ClassFactory.create(mapImplClass);
     }
     map.clear();
     state.target = map;
   } catch (AccessorException e) {
     // recover from error by setting a dummy Map that receives and discards the values
     handleGenericException(e, true);
     state.target = new HashMap();
   }
 }
  @Override
  public void contextDestroyed(ServletContextEvent sce) {
    try {
      OpenFlameDataSource bean = OpenFlameSpringContext.getBean(OpenFlameDataSource.class);
      bean.close();
    } catch (SQLException e) {
      e.printStackTrace();
    }
    try {
      Scheduler scheduler = OpenFlameSpringContext.getBean(Scheduler.class);
      scheduler.shutdown();
    } catch (SchedulerException e) {
      e.printStackTrace();
    }
    Env.clean();
    JAXBContextCache.clearCaches();
    ClassFactory.cleanCache();
    CachedIntrospectionResults.clearClassLoader(getClass().getClassLoader());

    super.contextDestroyed(sce);
  }
 /**
  * Must be called from same thread which created the UnmarshallerImpl instance.
  *
  * @throws IOException
  */
 public void close() throws IOException {
   ClassFactory.cleanCache();
 }