Java ConcurrentMap clearDefaultResourceBundles()

Here you can find the source of clearDefaultResourceBundles()

Description

Clears the internal list of resource bundles.

License

Apache License

Declaration

public static void clearDefaultResourceBundles() 

Method Source Code

//package com.java2s;
/*//from w  ww. j  a va 2 s  .c o m
 * $Id$
 *
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

public class Main {
    private static final ConcurrentMap<Integer, List<String>> classLoaderMap = new ConcurrentHashMap<>();
    private static final String XWORK_MESSAGES_BUNDLE = "com/opensymphony/xwork2/xwork-messages";

    /**
     * Clears the internal list of resource bundles.
     */
    public static void clearDefaultResourceBundles() {
        ClassLoader ccl = getCurrentThreadContextClassLoader();
        List<String> bundles = new ArrayList<>();
        classLoaderMap.put(ccl.hashCode(), bundles);
        bundles.add(0, XWORK_MESSAGES_BUNDLE);
    }

    private static ClassLoader getCurrentThreadContextClassLoader() {
        return Thread.currentThread().getContextClassLoader();
    }
}

Related

  1. addClassMapping(String className, Class clazz)
  2. addConcurrent(K key, C values, ConcurrentMap map)
  3. addIfAbsent(K key, ConcurrentMap map, Object value)
  4. clearClassMapping()
  5. create(boolean sorted)
  6. createConcurrentMap()
  7. createConcurrentMap()
  8. createConcurrentMap(int initial_capacity, float load_factor, int concurrency_level)