Example usage for java.util.concurrent ConcurrentHashMap putAll

List of usage examples for java.util.concurrent ConcurrentHashMap putAll

Introduction

In this page you can find the example usage for java.util.concurrent ConcurrentHashMap putAll.

Prototype

public void putAll(Map<? extends K, ? extends V> m) 

Source Link

Document

Copies all of the mappings from the specified map to this one.

Usage

From source file:ubicrypt.core.dto.VClock.java

@Override
public Object clone() throws CloneNotSupportedException {
    return new VClock(map.entrySet().stream().collect(ConcurrentHashMap<Integer, AtomicLong>::new,
            (ConcurrentHashMap<Integer, AtomicLong> map, Map.Entry<Integer, AtomicLong> entry) -> map
                    .put(entry.getKey(), new AtomicLong(entry.getValue().longValue())),
            (ConcurrentHashMap<Integer, AtomicLong> map1, ConcurrentHashMap<Integer, AtomicLong> map2) -> map1
                    .putAll(map2)));//from w w w .  ja v  a  2s .  c  om
}

From source file:org.archive.modules.recrawl.wbm.WbmPersistLoadProcessor.java

/**
 * all key-value pairs in this map will be added as HTTP headers.
 * typically used for providing authentication cookies. this method
 * makes a copy of {@requestHeaders}./*from  w  w  w.jav  a2s .  c o  m*/
 * <em>note:</em> this property may be dropped in the future if
 * I come up with better interface.
 * @param requestHeaders map of &lt;header-name, header-value>.
 */
public void setRequestHeaders(Map<String, String> requestHeaders) {
    if (requestHeaders == null) {
        this.requestHeaders.clear();
    } else {
        // TODO: mmm, ConcurrentHashMap may be overkill. simple synchronized Hashtable would work
        // just okay?
        ConcurrentHashMap<String, String> m = new ConcurrentHashMap<String, String>(1, 0.75f, 2);
        m.putAll(requestHeaders);
        this.requestHeaders = m;
    }
}

From source file:org.j2free.mixpanel.MixpanelClient.java

/**
 * Registers a set of properties to be included with all events tracked using the same distinctId.
 *
 * @param distinctId//w ww.j a v a  2 s.  co  m
 * @param allProps
 */
public void registerProperties(String distinctId, Map<String, String> allProps) {
    // Non-blocking algorithm
    ConcurrentHashMap<String, String> userMap = userPropertiesMap.get(distinctId);

    // If there wasn't a map when we checked, we need to create one, try to put it, and make sure
    // that the eventual map we add properties to is the one stored.
    if (userMap == null) {
        // create a temp new map
        userMap = new ConcurrentHashMap<String, String>();

        // try to put this user map into the static map
        ConcurrentHashMap<String, String> storedMap = userPropertiesMap.putIfAbsent(distinctId, userMap);

        // If another thread put a user map in the static map before we could, then putIfAbsent will
        // return that map, in which case we should use it.  Otherwise, userMap is already set to the
        // stored map.
        if (storedMap != null)
            userMap = storedMap;
    }

    // Okay, now userMap is guaranteed to be the stored map
    userMap.putAll(allProps);
}

From source file:org.apache.drill.exec.store.parquet.metadata.Metadata.java

/**
 * Create the parquet metadata files for the directory at the given path and for any subdirectories.
 * Metadata cache files written to the disk contain relative paths. Returned Pair of metadata contains absolute paths.
 *
 * @param path to the directory of the parquet table
 * @param fs file system// www. jav a 2  s.c o  m
 * @return Pair of parquet metadata. The left one is a parquet metadata for the table. The right one of the Pair is
 *         a metadata for all subdirectories (if they are present and there are no any parquet files in the
 *         {@code path} directory).
 * @throws IOException if parquet metadata can't be serialized and written to the json file
 */
private Pair<ParquetTableMetadata_v3, ParquetTableMetadataDirs> createMetaFilesRecursively(final String path,
        FileSystem fs) throws IOException {
    Stopwatch timer = logger.isDebugEnabled() ? Stopwatch.createStarted() : null;
    List<ParquetFileMetadata_v3> metaDataList = Lists.newArrayList();
    List<String> directoryList = Lists.newArrayList();
    ConcurrentHashMap<ColumnTypeMetadata_v3.Key, ColumnTypeMetadata_v3> columnTypeInfoSet = new ConcurrentHashMap<>();
    Path p = new Path(path);
    FileStatus fileStatus = fs.getFileStatus(p);
    assert fileStatus.isDirectory() : "Expected directory";

    final Map<FileStatus, FileSystem> childFiles = new LinkedHashMap<>();

    for (final FileStatus file : DrillFileSystemUtil.listAll(fs, p, false)) {
        if (file.isDirectory()) {
            ParquetTableMetadata_v3 subTableMetadata = (createMetaFilesRecursively(file.getPath().toString(),
                    fs)).getLeft();
            metaDataList.addAll(subTableMetadata.files);
            directoryList.addAll(subTableMetadata.directories);
            directoryList.add(file.getPath().toString());
            // Merge the schema from the child level into the current level
            //TODO: We need a merge method that merges two columns with the same name but different types
            columnTypeInfoSet.putAll(subTableMetadata.columnTypeInfo);
        } else {
            childFiles.put(file, fs);
        }
    }
    ParquetTableMetadata_v3 parquetTableMetadata = new ParquetTableMetadata_v3(
            SUPPORTED_VERSIONS.last().toString(), DrillVersionInfo.getVersion());
    if (childFiles.size() > 0) {
        List<ParquetFileMetadata_v3> childFilesMetadata = getParquetFileMetadata_v3(parquetTableMetadata,
                childFiles);
        metaDataList.addAll(childFilesMetadata);
        // Note that we do not need to merge the columnInfo at this point. The columnInfo is already added
        // to the parquetTableMetadata.
    }

    parquetTableMetadata.directories = directoryList;
    parquetTableMetadata.files = metaDataList;
    // TODO: We need a merge method that merges two columns with the same name but different types
    if (parquetTableMetadata.columnTypeInfo == null) {
        parquetTableMetadata.columnTypeInfo = new ConcurrentHashMap<>();
    }
    parquetTableMetadata.columnTypeInfo.putAll(columnTypeInfoSet);

    for (String oldName : OLD_METADATA_FILENAMES) {
        fs.delete(new Path(p, oldName), false);
    }
    //  relative paths in the metadata are only necessary for meta cache files.
    ParquetTableMetadata_v3 metadataTableWithRelativePaths = MetadataPathUtils
            .createMetadataWithRelativePaths(parquetTableMetadata, path);
    writeFile(metadataTableWithRelativePaths, new Path(p, METADATA_FILENAME), fs);

    if (directoryList.size() > 0 && childFiles.size() == 0) {
        ParquetTableMetadataDirs parquetTableMetadataDirsRelativePaths = new ParquetTableMetadataDirs(
                metadataTableWithRelativePaths.directories);
        writeFile(parquetTableMetadataDirsRelativePaths, new Path(p, METADATA_DIRECTORIES_FILENAME), fs);
        if (timer != null) {
            logger.debug("Creating metadata files recursively took {} ms",
                    timer.elapsed(TimeUnit.MILLISECONDS));
        }
        ParquetTableMetadataDirs parquetTableMetadataDirs = new ParquetTableMetadataDirs(directoryList);
        return Pair.of(parquetTableMetadata, parquetTableMetadataDirs);
    }
    List<String> emptyDirList = Lists.newArrayList();
    if (timer != null) {
        logger.debug("Creating metadata files recursively took {} ms", timer.elapsed(TimeUnit.MILLISECONDS));
        timer.stop();
    }
    return Pair.of(parquetTableMetadata, new ParquetTableMetadataDirs(emptyDirList));
}

From source file:org.apache.drill.exec.store.parquet.Metadata.java

/**
 * Create the parquet metadata file for the directory at the given path, and for any subdirectories
 *
 * @param path/*ww w . j  av  a 2 s.  co  m*/
 * @throws IOException
 */
private Pair<ParquetTableMetadata_v3, ParquetTableMetadataDirs> createMetaFilesRecursively(final String path)
        throws IOException {
    Stopwatch timer = Stopwatch.createStarted();
    List<ParquetFileMetadata_v3> metaDataList = Lists.newArrayList();
    List<String> directoryList = Lists.newArrayList();
    ConcurrentHashMap<ColumnTypeMetadata_v3.Key, ColumnTypeMetadata_v3> columnTypeInfoSet = new ConcurrentHashMap<>();
    Path p = new Path(path);
    FileStatus fileStatus = fs.getFileStatus(p);
    assert fileStatus.isDirectory() : "Expected directory";

    final List<FileStatus> childFiles = Lists.newArrayList();

    for (final FileStatus file : fs.listStatus(p, new DrillPathFilter())) {
        if (file.isDirectory()) {
            ParquetTableMetadata_v3 subTableMetadata = (createMetaFilesRecursively(file.getPath().toString()))
                    .getLeft();
            metaDataList.addAll(subTableMetadata.files);
            directoryList.addAll(subTableMetadata.directories);
            directoryList.add(file.getPath().toString());
            // Merge the schema from the child level into the current level
            //TODO: We need a merge method that merges two colums with the same name but different types
            columnTypeInfoSet.putAll(subTableMetadata.columnTypeInfo);
        } else {
            childFiles.add(file);
        }
    }
    ParquetTableMetadata_v3 parquetTableMetadata = new ParquetTableMetadata_v3(true);
    if (childFiles.size() > 0) {
        List<ParquetFileMetadata_v3> childFilesMetadata = getParquetFileMetadata_v3(parquetTableMetadata,
                childFiles);
        metaDataList.addAll(childFilesMetadata);
        // Note that we do not need to merge the columnInfo at this point. The columnInfo is already added
        // to the parquetTableMetadata.
    }

    parquetTableMetadata.directories = directoryList;
    parquetTableMetadata.files = metaDataList;
    //TODO: We need a merge method that merges two colums with the same name but different types
    if (parquetTableMetadata.columnTypeInfo == null) {
        parquetTableMetadata.columnTypeInfo = new ConcurrentHashMap<>();
    }
    parquetTableMetadata.columnTypeInfo.putAll(columnTypeInfoSet);

    for (String oldname : OLD_METADATA_FILENAMES) {
        fs.delete(new Path(p, oldname), false);
    }
    writeFile(parquetTableMetadata, new Path(p, METADATA_FILENAME));

    if (directoryList.size() > 0 && childFiles.size() == 0) {
        ParquetTableMetadataDirs parquetTableMetadataDirs = new ParquetTableMetadataDirs(directoryList);
        writeFile(parquetTableMetadataDirs, new Path(p, METADATA_DIRECTORIES_FILENAME));
        logger.info("Creating metadata files recursively took {} ms", timer.elapsed(TimeUnit.MILLISECONDS));
        timer.stop();
        return Pair.of(parquetTableMetadata, parquetTableMetadataDirs);
    }
    List<String> emptyDirList = Lists.newArrayList();
    logger.info("Creating metadata files recursively took {} ms", timer.elapsed(TimeUnit.MILLISECONDS));
    timer.stop();
    return Pair.of(parquetTableMetadata, new ParquetTableMetadataDirs(emptyDirList));
}

From source file:com.web.server.SARDeployer.java

/**
 * This method is the implementation of the SAR deployer
 *//*from ww w .jav a 2 s . c o  m*/
public void run() {
    String filePath;
    FileInfo fileinfoTmp;
    ConcurrentHashMap filePrevMap = new ConcurrentHashMap();
    ConcurrentHashMap fileCurrMap = new ConcurrentHashMap();
    ;

    FileInfo filePrevLastModified;
    FileInfo fileCurrLastModified;
    DigesterLoader serverdigesterLoader = DigesterLoader.newLoader(new FromXmlRulesModule() {

        protected void loadRules() {
            // TODO Auto-generated method stub
            try {
                loadXMLRules(new InputSource(new FileInputStream("./config/sar-config.xml")));
            } catch (FileNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

        }
    });
    sardigester = serverdigesterLoader.newDigester();
    while (true) {
        try {
            File file = new File(deployDirectory);
            File[] files = file.listFiles();
            for (int i = 0; i < files.length; i++) {
                if (files[i].isDirectory())
                    continue;
                //Long lastModified=(Long) fileMap.get(files[i].getName());
                if (files[i].getName().toLowerCase().endsWith(".sar")) {
                    filePath = files[i].getAbsolutePath();
                    //logger.info("filePath"+filePath);
                    filePath = filePath.substring(0, filePath.toLowerCase().lastIndexOf(".sar"));
                    File sarDirectory = new File(filePath + "sar");
                    fileinfoTmp = new FileInfo();
                    fileinfoTmp.setFile(files[i]);
                    fileinfoTmp.setLastModified(files[i].lastModified());
                    if (!sarDirectory.exists() || fileCurrMap.get(files[i].getName()) == null
                            && filePrevMap.get(files[i].getName()) == null) {
                        if (sarDirectory.exists()) {
                            deleteDir(sarDirectory);
                        }
                        try {
                            extractSar(files[i], sarDirectory.getAbsolutePath());
                        } catch (IOException e) {
                            // TODO Auto-generated catch block
                            e.printStackTrace();
                        }
                        //System.out.println("War Deployed Successfully in path: "+filePath);
                        numberOfSarDeployed++;
                        logger.info(files[i] + " Deployed");
                        sarsDeployed.add(files[i].getName());
                        filePrevMap.put(files[i].getName(), fileinfoTmp);
                    }
                    fileCurrMap.put(files[i].getName(), fileinfoTmp);
                }
                /*if(lastModified==null||lastModified!=files[i].lastModified()){
                   fileMap.put(files[i].getName(),files[i].lastModified());
                }*/
            }
            Set keyset = fileCurrMap.keySet();
            Iterator ite = keyset.iterator();
            String fileName;
            while (ite.hasNext()) {
                fileName = (String) ite.next();
                //logger.info("fileName"+fileName);
                filePrevLastModified = (FileInfo) filePrevMap.get(fileName);
                fileCurrLastModified = (FileInfo) fileCurrMap.get(fileName);
                if (filePrevLastModified != null)
                    //logger.info("lastmodified="+filePrevLastModified.getLastModified());
                    //System.out.println("prevmodified"+fileCurrLastModified.getLastModified()+""+filePrevLastModified.getLastModified());
                    if (fileCurrLastModified != null) {
                        //System.out.println("prevmodified"+fileCurrLastModified.getLastModified());
                    }
                if (filePrevLastModified == null
                        || filePrevLastModified.getLastModified() != fileCurrLastModified.getLastModified()) {
                    filePath = fileCurrLastModified.getFile().getAbsolutePath();
                    //logger.info("filePath"+filePath);
                    filePath = filePath.substring(0, filePath.toLowerCase().lastIndexOf(".sar"));
                    File sarDirectory = new File(filePath + "sar");
                    //logger.info("WARDIRECTORY="+warDirectory.getAbsolutePath());
                    if (sarDirectory.exists() && sarDirectory.isDirectory()) {
                        deleteDir(sarDirectory);
                        sarsDeployed.remove(fileName);
                        numberOfSarDeployed--;
                    }
                    try {
                        extractSar(fileCurrLastModified.getFile(), sarDirectory.getAbsolutePath());
                    } catch (IOException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                    //System.out.println("War Deployed Successfully in path: "+fileCurrLastModified.getFile().getAbsolutePath());
                    numberOfSarDeployed++;
                    sarsDeployed.add(fileName);
                    logger.info(filePath + ".sar Deployed");
                }
            }
            keyset = filePrevMap.keySet();
            ite = keyset.iterator();
            while (ite.hasNext()) {
                fileName = (String) ite.next();
                filePrevLastModified = (FileInfo) filePrevMap.get(fileName);
                fileCurrLastModified = (FileInfo) fileCurrMap.get(fileName);
                if (fileCurrLastModified == null) {
                    filePath = filePrevLastModified.getFile().getAbsolutePath();
                    filePath = filePath.substring(0, filePath.toLowerCase().lastIndexOf(".sar"));
                    logger.info("filePath" + filePath);
                    File deleteDirectory = new File(filePath + "sar");
                    deleteDir(deleteDirectory);
                    numberOfSarDeployed--;
                    sarsDeployed.remove(fileName);
                    logger.info(filePath + ".sar Undeployed");
                }
            }
            filePrevMap.keySet().removeAll(filePrevMap.keySet());
            filePrevMap.putAll(fileCurrMap);
            fileCurrMap.keySet().removeAll(fileCurrMap.keySet());
            //System.out.println("filePrevMap="+filePrevMap);
            //System.out.println("fileCurrMap="+fileCurrMap);
            try {
                Thread.sleep(3000);
            } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        } catch (Exception ex) {
            ex.printStackTrace();
            System.out.println("Sar Deployed");
        }
    }
}

From source file:com.web.server.WarDeployer.java

/**
 * This method is the implementation of the war deployer which frequently scans the deploy
 * directory and if there is a change in war redeploys and configures the map
 *///from w  w w .  j av a 2 s  .c  o m
public void run() {
    File file;
    ConcurrentHashMap filePrevMap = new ConcurrentHashMap();
    ConcurrentHashMap fileCurrMap = new ConcurrentHashMap();
    ;

    FileInfo filePrevLastModified;
    FileInfo fileCurrLastModified;
    String filePath;
    FileInfo fileinfoTmp;
    URLClassLoader loader = (URLClassLoader) ClassLoader.getSystemClassLoader();
    URL[] urls = loader.getURLs();
    warsDeployed = new CopyOnWriteArrayList();
    //System.out.println("URLS="+urls[0]);
    WebClassLoader customClassLoader;
    while (true) {
        file = new File(scanDirectory);
        File[] files = file.listFiles();
        for (int i = 0; i < files.length; i++) {
            if (files[i].isDirectory())
                continue;
            //Long lastModified=(Long) fileMap.get(files[i].getName());
            if (files[i].getName().endsWith(".war")) {
                filePath = files[i].getAbsolutePath();
                //logger.info("filePath"+filePath);
                filePath = filePath.substring(0, filePath.toLowerCase().lastIndexOf(".war"));
                File warDirectory = new File(filePath);
                fileinfoTmp = new FileInfo();
                fileinfoTmp.setFile(files[i]);
                fileinfoTmp.setLastModified(files[i].lastModified());
                if (!warDirectory.exists() || fileCurrMap.get(files[i].getName()) == null
                        && filePrevMap.get(files[i].getName()) == null) {
                    if (warDirectory.exists()) {
                        deleteDir(warDirectory);
                    }
                    customClassLoader = new WebClassLoader(urls);
                    synchronized (urlClassLoaderMap) {
                        logger.info("WARDIRECTORY=" + warDirectory.getAbsolutePath());
                        urlClassLoaderMap.put(warDirectory.getAbsolutePath().replace("\\", "/"),
                                customClassLoader);
                    }
                    extractWar(files[i], customClassLoader);
                    //System.out.println("War Deployed Successfully in path: "+filePath);
                    AddUrlToClassLoader(warDirectory, customClassLoader);
                    numberOfWarDeployed++;
                    logger.info(files[i] + " Deployed");
                    warsDeployed.add(files[i].getName());
                    filePrevMap.put(files[i].getName(), fileinfoTmp);
                }
                fileCurrMap.put(files[i].getName(), fileinfoTmp);
            }
            /*if(lastModified==null||lastModified!=files[i].lastModified()){
               fileMap.put(files[i].getName(),files[i].lastModified());
            }*/
        }
        Set keyset = fileCurrMap.keySet();
        Iterator ite = keyset.iterator();
        String fileName;
        while (ite.hasNext()) {
            fileName = (String) ite.next();
            //logger.info("fileName"+fileName);
            filePrevLastModified = (FileInfo) filePrevMap.get(fileName);
            fileCurrLastModified = (FileInfo) fileCurrMap.get(fileName);
            if (filePrevLastModified != null)
                //logger.info("lastmodified="+filePrevLastModified.getLastModified());
                //System.out.println("prevmodified"+fileCurrLastModified.getLastModified()+""+filePrevLastModified.getLastModified());
                if (fileCurrLastModified != null) {
                    //System.out.println("prevmodified"+fileCurrLastModified.getLastModified());
                }
            if (filePrevLastModified == null
                    || filePrevLastModified.getLastModified() != fileCurrLastModified.getLastModified()) {
                filePath = fileCurrLastModified.getFile().getAbsolutePath();
                //logger.info("filePath"+filePath);
                filePath = filePath.substring(0, filePath.toLowerCase().lastIndexOf(".war"));
                File warDirectory = new File(filePath);
                //logger.info("WARDIRECTORY="+warDirectory.getAbsolutePath());
                if (warDirectory.exists()) {
                    WebClassLoader webClassLoader = (WebClassLoader) urlClassLoaderMap
                            .get(warDirectory.getAbsolutePath().replace("\\", "/"));
                    synchronized (executorServiceMap) {
                        try {
                            new ExecutorServicesConstruct().removeExecutorServices(executorServiceMap,
                                    new File(warDirectory.getAbsolutePath().replace("\\", "/") + "/WEB-INF/"
                                            + "executorservices.xml"),
                                    webClassLoader);
                        } catch (Exception e) {
                            // TODO Auto-generated catch block
                            e.printStackTrace();
                        }
                        //System.out.println("executorServiceMap"+executorServiceMap);
                    }
                    synchronized (messagingClassMap) {
                        try {
                            new MessagingClassConstruct().removeMessagingClass(messagedigester,
                                    new File(warDirectory.getAbsolutePath().replace("\\", "/") + "/WEB-INF/"
                                            + "messagingclass.xml"),
                                    messagingClassMap);
                        } catch (Exception e) {
                            // TODO Auto-generated catch block
                            e.printStackTrace();
                        }
                        System.out.println("executorServiceMap" + executorServiceMap);
                    }
                    ClassLoaderUtil.cleanupJarFileFactory(ClassLoaderUtil.closeClassLoader(webClassLoader));
                    try {
                        webClassLoader.close();
                    } catch (IOException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                    logger.info("ServletMapping" + servletMapping);
                    logger.info("warDirectory=" + warDirectory.getAbsolutePath().replace("\\", "/"));
                    urlClassLoaderMap.remove(warDirectory.getAbsolutePath().replace("\\", "/"));
                    WebAppConfig webAppConfig = (WebAppConfig) servletMapping
                            .remove(warDirectory.getAbsolutePath().replace("\\", "/"));
                    System.gc();
                    deleteDir(warDirectory);
                    warsDeployed.remove(fileName);
                    removeServletFromSessionObject(webAppConfig,
                            warDirectory.getAbsolutePath().replace("\\", "/"));
                    numberOfWarDeployed--;
                }
                customClassLoader = new WebClassLoader(urls);
                logger.info(customClassLoader);
                urlClassLoaderMap.put(warDirectory.getAbsolutePath().replace("\\", "/"), customClassLoader);
                extractWar(fileCurrLastModified.getFile(), customClassLoader);
                //System.out.println("War Deployed Successfully in path: "+fileCurrLastModified.getFile().getAbsolutePath());
                AddUrlToClassLoader(warDirectory, customClassLoader);
                numberOfWarDeployed++;
                warsDeployed.add(fileName);
                logger.info(filePath + ".war Deployed");
            }
        }
        keyset = filePrevMap.keySet();
        ite = keyset.iterator();
        while (ite.hasNext()) {
            fileName = (String) ite.next();
            filePrevLastModified = (FileInfo) filePrevMap.get(fileName);
            fileCurrLastModified = (FileInfo) fileCurrMap.get(fileName);
            if (fileCurrLastModified == null) {
                filePath = filePrevLastModified.getFile().getAbsolutePath();
                filePath = filePath.substring(0, filePath.toLowerCase().lastIndexOf(".war"));
                logger.info("filePath" + filePath);
                File deleteDirectory = new File(filePath);
                logger.info("Delete Directory" + deleteDirectory.getAbsolutePath().replace("\\", "/"));
                WebClassLoader webClassLoader = (WebClassLoader) urlClassLoaderMap
                        .get(deleteDirectory.getAbsolutePath().replace("\\", "/"));
                ;
                synchronized (executorServiceMap) {

                    try {
                        new ExecutorServicesConstruct().removeExecutorServices(executorServiceMap,
                                new File(deleteDirectory.getAbsolutePath().replace("\\", "/") + "/WEB-INF/"
                                        + "executorservices.xml"),
                                webClassLoader);
                    } catch (Exception e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                    //System.out.println("executorServiceMap"+executorServiceMap);
                }
                synchronized (messagingClassMap) {
                    try {
                        new MessagingClassConstruct().removeMessagingClass(messagedigester,
                                new File(deleteDirectory.getAbsolutePath().replace("\\", "/") + "/WEB-INF/"
                                        + "messagingclass.xml"),
                                messagingClassMap);
                    } catch (Exception e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                    //System.out.println("executorServiceMap"+executorServiceMap);
                }
                WebAppConfig webAppConfig = (WebAppConfig) servletMapping
                        .remove(deleteDirectory.getAbsolutePath().replace("\\", "/"));
                ClassLoaderUtil.cleanupJarFileFactory(ClassLoaderUtil.closeClassLoader(webClassLoader));
                urlClassLoaderMap.remove(deleteDirectory.getAbsolutePath().replace("\\", "/"));
                logger.info("ServletMapping" + servletMapping);
                logger.info("warDirectory=" + deleteDirectory.getAbsolutePath().replace("\\", "/"));
                try {
                    logger.info(webClassLoader);
                    logger.info("CLASSLOADER IS CLOSED");
                    webClassLoader.close();
                } catch (Throwable e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                System.gc();
                deleteDir(deleteDirectory);
                numberOfWarDeployed--;
                warsDeployed.remove(fileName);
                try {
                    removeServletFromSessionObject(webAppConfig,
                            deleteDirectory.getAbsolutePath().replace("\\", "/"));
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
                logger.info(filePath + ".war Undeployed");
            }
        }
        filePrevMap.keySet().removeAll(filePrevMap.keySet());
        filePrevMap.putAll(fileCurrMap);
        fileCurrMap.keySet().removeAll(fileCurrMap.keySet());
        //System.out.println("filePrevMap="+filePrevMap);
        //System.out.println("fileCurrMap="+fileCurrMap);
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}