Example usage for java.lang System runFinalization

List of usage examples for java.lang System runFinalization

Introduction

In this page you can find the example usage for java.lang System runFinalization.

Prototype

public static void runFinalization() 

Source Link

Document

Runs the finalization methods of any objects pending finalization.

Usage

From source file:com.l2jfree.L2Config.java

protected static void applicationLoaded(String appName, String[] versionInfo, boolean dumpHeap) {
    Util.printSection("Summary");
    for (String line : versionInfo)
        _log.info(line);/*from ww  w  . j a  v a2s .co m*/
    _log.info("Operating System: " + Util.getOSName() + " " + Util.getOSVersion() + " " + Util.getOSArch());
    _log.info("Available CPUs: " + Util.getAvailableProcessors());

    System.gc();
    System.runFinalization();

    for (String line : Util.getMemUsage())
        _log.info(line);

    _log.info("Server loaded in " + Util.formatNumber(ManagementFactory.getRuntimeMXBean().getUptime())
            + " milliseconds.");

    if (dumpHeap && !L2Config.LAUNCHED_FROM_IDE)
        L2System.dumpHeap(true);

    Util.printSection(appName);

    Startup.onStartup();
}

From source file:org.xwoot.wootEngine.ContentManager.java

/**
 * Serializes a WootContent object and requests finalization and garbage collection to free the used resources.
 * //from www  .  j  a  v a2s.c o m
 * @param wootContent the object to serialize and unload.
 * @throws WootEngineException if problems occur while serializing the object.
 * @see #storeWootContent(WootContent)
 * @see System#runFinalization()
 * @see System#gc()
 */
public synchronized void unloadWootContent(WootContent wootContent) throws WootEngineException {
    this.storeWootContent(wootContent);
    System.runFinalization();
    System.gc();
}

From source file:com.vmware.identity.idm.server.LocalOsIdentityProviderTest.java

@AfterClass
public static void testTearDown() {
    try {//from w ww. j a  va 2s  .co  m
        ISecurityAccountsLibrary lib = getSamLib();

        if (lib != null) {
            try {
                if (_users != null) {
                    for (UserInfo userInfo : _users.values()) {
                        lib.DeleteUser(userInfo.getName());
                    }

                    _users = null;
                }

                if (_groups != null) {
                    for (GroupInfo groupInfo : _groups.values()) {
                        lib.DeleteGroup(groupInfo.getName());
                    }

                    _groups = null;
                }
            } finally {
                lib.close();
                _lib = null;
            }
        }
    } finally {
        System.gc();
        System.runFinalization();
    }
}

From source file:org.leo.benchmark.Benchmark.java

/**
 * Force (very) heavy GC/*from   www  . java2 s  . c o  m*/
 */
private void heavyGc() {
    try {
        System.gc();
        Thread.sleep(200);
        System.runFinalization();
        Thread.sleep(200);
        System.gc();
        Thread.sleep(200);
        System.runFinalization();
        Thread.sleep(1000);
        System.gc();
        Thread.sleep(200);
        System.runFinalization();
        Thread.sleep(200);
        System.gc();
    } catch (InterruptedException ex) {
        ex.printStackTrace();
    }
}

From source file:org.allcolor.yahp.converter.CClassLoader.java

/**
 * destroy the loader tree//  w  w  w. j a v a2s .  c  om
 */
public static final void destroy() {
    if (CClassLoader.rootLoader == null) {
        return;
    }
    System.out.println("Destroying YAHP ClassLoader Tree");

    CClassLoader.urlLoader = null;

    try {
        Field f = Class.forName("java.lang.Shutdown").getDeclaredField("hooks");
        f.setAccessible(true);
        ArrayList l = (ArrayList) f.get(null);
        for (Iterator it = l.iterator(); it.hasNext();) {
            Object o = it.next();
            if ((o != null) && (o.getClass().getClassLoader() != null)
                    && (o.getClass().getClassLoader().getClass() == CClassLoader.class)) {
                it.remove();
            }
        }
    } catch (Throwable ignore) {
    }

    try {
        Field f = Class.forName("java.lang.ApplicationShutdownHooks").getDeclaredField("hooks");
        f.setAccessible(true);
        IdentityHashMap l = (IdentityHashMap) f.get(null);
        for (Iterator it = l.entrySet().iterator(); it.hasNext();) {
            Entry e = (Entry) it.next();
            Thread o = (Thread) e.getKey();
            if ((o != null) && (o.getClass().getClassLoader() != null)
                    && (o.getClass().getClassLoader().getClass() == CClassLoader.class)) {
                it.remove();
                continue;
            }
            o = (Thread) e.getValue();
            if ((o != null) && (o.getClass().getClassLoader() != null)
                    && (o.getClass().getClassLoader().getClass() == CClassLoader.class)) {
                it.remove();
            }
        }
    } catch (Throwable ignore) {
    }

    try {
        if ((UIManager.getLookAndFeel() != null)
                && (UIManager.getLookAndFeel().getClass().getClassLoader() != null)
                && (UIManager.getLookAndFeel().getClass().getClassLoader().getClass() == CClassLoader.class)) {
            UIManager.setLookAndFeel((LookAndFeel) null);
        }
        Field f = UIManager.class.getDeclaredField("currentLAFState");
        f.setAccessible(true);
        Object lafstate = f.get(null);
        if (lafstate != null) {
            Field fmultiUIDefaults = lafstate.getClass().getDeclaredField("multiUIDefaults");
            fmultiUIDefaults.setAccessible(true);
            Object multiUIDefaults = fmultiUIDefaults.get(lafstate);
            Method clear = multiUIDefaults.getClass().getDeclaredMethod("clear", (Class[]) null);
            clear.setAccessible(true);
            clear.invoke(multiUIDefaults, (Object[]) null);
            Field tbl = lafstate.getClass().getDeclaredField("tables");
            tbl.setAccessible(true);
            Hashtable[] tables = (Hashtable[]) tbl.get(lafstate);
            if (tables != null) {
                for (int i = 0; i < tables.length; i++) {
                    Hashtable element = tables[i];
                    if (element != null) {
                        element.clear();
                    }
                }
            }
        }
    } catch (Throwable ignore) {
    }

    try {
        Hashtable tb = UIManager.getDefaults();
        Object cl = tb.get("ClassLoader");
        if (cl.getClass() == CClassLoader.class) {
            tb.put("ClassLoader", CClassLoader.rootLoader.getParent());
        }
    } catch (Throwable ignore) {
    }

    Method logFactoryRelease = null;

    try {
        logFactoryRelease = CClassLoader.rootLoader.loadClass("org.apache.commons.logging.LogFactory")
                .getMethod("release", new Class[] { ClassLoader.class });
    } catch (final Throwable ignore) {
    }

    CClassLoader.rootLoader._destroy(logFactoryRelease);
    CClassLoader.mandatoryLoadersMap.clear();
    CClassLoader.rootLoader = null;

    // deregister any sql driver loaded
    try {
        final List deregisterList = new ArrayList();
        for (final Enumeration it = DriverManager.getDrivers(); it.hasMoreElements();) {
            final Driver d = (Driver) it.nextElement();

            if ((d != null) && (d.getClass().getClassLoader() != null)
                    && (d.getClass().getClassLoader().getClass() == CClassLoader.class)) {
                deregisterList.add(d);
            }
        }

        for (int i = 0; i < deregisterList.size(); i++) {
            final Driver driver = (Driver) deregisterList.get(i);
            DriverManager.deregisterDriver(driver);
        }
    } catch (final Throwable ignore) {
    }

    // stop dandling thread created with this classloader
    // tested only on sun jdk
    ThreadGroup tg = Thread.currentThread().getThreadGroup();
    while ((tg != null) && (tg.getParent() != null)) {
        tg = tg.getParent();
    }
    List ltg = new ArrayList();
    ltg.add(tg);
    CClassLoader.getThreadGroups(tg, ltg);
    for (int ii = 0; ii < ltg.size(); ii++) {
        try {
            final ThreadGroup g = (ThreadGroup) ltg.get(ii);
            final Field fthreads = ThreadGroup.class.getDeclaredField("threads");
            fthreads.setAccessible(true);

            final List toStop = new ArrayList();
            Object threads[] = null;

            if (fthreads.getType() == Vector.class) {
                // in gnu classpath
                threads = ((Vector) fthreads.get(g)).toArray();
            } else {
                // sun
                threads = (Object[]) fthreads.get(g);
            }

            for (int i = 0; i < threads.length; i++) {
                if (threads[i] == null) {
                    continue;
                }
                if ((threads[i] != null) && (((Thread) threads[i]).getContextClassLoader() != null)
                        && (((Thread) threads[i]).getContextClassLoader().getClass() == CClassLoader.class)) {
                    ((Thread) threads[i]).setContextClassLoader(null);
                }
                if ((threads[i] != null) && (threads[i].getClass().getClassLoader() != null)
                        && (threads[i].getClass().getClassLoader().getClass() == CClassLoader.class)) {
                    toStop.add((Thread) threads[i]);
                }

                // remove any object in threadLocal referring an object
                // loaded
                // by this classloader tree
                try {
                    final Field fthreadLocals = Thread.class.getDeclaredField("threadLocals");
                    fthreadLocals.setAccessible(true);

                    final Object threadLocals = fthreadLocals.get(threads[i]);
                    if (threadLocals != null) {
                        final Field ftable = threadLocals.getClass().getDeclaredField("table");
                        ftable.setAccessible(true);

                        final Object table[] = (Object[]) ftable.get(threadLocals);

                        for (int kk = 0; kk < table.length; kk++) {
                            final Object element = table[kk];
                            if (element != null) {
                                final Field fvalue = element.getClass().getDeclaredField("value");
                                fvalue.setAccessible(true);

                                final Object value = fvalue.get(element);

                                if ((value != null) && (value.getClass().getClassLoader() != null) && (value
                                        .getClass().getClassLoader().getClass() == CClassLoader.class)) {
                                    fvalue.set(element, null);
                                }
                                if (value instanceof Map) {
                                    clearMap((Map) value);
                                } else if (value instanceof List) {
                                    clearList((List) value);
                                } else if (value instanceof Set) {
                                    clearSet((Set) value);
                                } else if (value instanceof Object[]) {
                                    clearArray((Object[]) value);
                                }

                                fvalue.setAccessible(false);
                            }
                        }
                        ftable.setAccessible(false);
                    }
                    fthreadLocals.setAccessible(false);
                } catch (final Throwable ignore) {
                    ignore.printStackTrace();
                }

                // remove any object in threadLocal referring an object
                // loaded
                // by this classloader tree
                try {
                    final Field fthreadLocals = Thread.class.getDeclaredField("inheritableThreadLocals");
                    fthreadLocals.setAccessible(true);

                    final Object threadLocals = fthreadLocals.get(threads[i]);
                    if (threadLocals != null) {
                        final Field ftable = threadLocals.getClass().getDeclaredField("table");
                        ftable.setAccessible(true);

                        final Object table[] = (Object[]) ftable.get(threadLocals);

                        for (int kk = 0; kk < table.length; kk++) {
                            final Object element = table[kk];
                            if (element != null) {
                                final Field fvalue = element.getClass().getDeclaredField("value");
                                fvalue.setAccessible(true);

                                final Object value = fvalue.get(element);

                                if ((value != null) && (value.getClass().getClassLoader() != null) && (value
                                        .getClass().getClassLoader().getClass() == CClassLoader.class)) {
                                    fvalue.set(element, null);
                                }
                                if (value instanceof Map) {
                                    clearMap((Map) value);
                                } else if (value instanceof List) {
                                    clearList((List) value);
                                } else if (value instanceof Set) {
                                    clearSet((Set) value);
                                } else if (value instanceof Object[]) {
                                    clearArray((Object[]) value);
                                }

                                fvalue.setAccessible(false);
                            }
                        }

                        ftable.setAccessible(false);
                    }
                    fthreadLocals.setAccessible(false);
                } catch (final Throwable ignore) {
                    ignore.printStackTrace();
                }

                // remove any protection domain referring this loader tree
                try {
                    final Field finheritedAccessControlContext = Thread.class
                            .getDeclaredField("inheritedAccessControlContext");
                    finheritedAccessControlContext.setAccessible(true);

                    final Object inheritedAccessControlContext = finheritedAccessControlContext.get(threads[i]);

                    if (inheritedAccessControlContext != null) {
                        final Field fcontext = AccessControlContext.class.getDeclaredField("context");
                        fcontext.setAccessible(true);

                        final Object context[] = (Object[]) fcontext.get(inheritedAccessControlContext);

                        if (context != null) {
                            for (int k = 0; k < context.length; k++) {
                                if (context[k] == null)
                                    continue;
                                final Field fclassloader = ProtectionDomain.class
                                        .getDeclaredField("classloader");
                                fclassloader.setAccessible(true);

                                final Object classloader = fclassloader.get(context[k]);

                                if ((classloader != null) && (classloader.getClass() == CClassLoader.class)) {
                                    context[k] = null;
                                }

                                fclassloader.setAccessible(false);
                            }
                        }

                        fcontext.setAccessible(false);
                    }

                    finheritedAccessControlContext.setAccessible(false);
                } catch (final Throwable ignore) {
                    ignore.printStackTrace();
                }
            }

            fthreads.setAccessible(false);
            for (int i = 0; i < toStop.size(); i++) {
                try {
                    final Thread t = (Thread) toStop.get(i);
                    final Method stop = t.getClass().getMethod("stop", (Class[]) null);
                    stop.invoke(t, (Object[]) null);
                } catch (final Throwable ignore) {
                }
            }
        } catch (final Throwable ignore) {
        }
    }
    try {
        CThreadContext.destroy();
    } catch (Throwable ignore) {
    }
    System.runFinalization();
    System.gc();
    Introspector.flushCaches();
    System.out.println("Destroying YAHP ClassLoader Tree : done");
}

From source file:Debug.java

public static final void purgeMemory() {
    try {//ww  w  .  j a  v a2  s.co  m
        //            Thread.sleep(50);
        System.runFinalization();
        Thread.sleep(50);
        System.gc();
        Thread.sleep(50);
    } catch (Throwable e) {
        Debug.debug(e);
    }
}

From source file:org.trianacode.taskgraph.service.RunnableTask.java

/**
 * Tries running the process() method./*from   ww  w. j  a v a  2 s .  com*/
 * <p/>
 * TODO: Better error handling
 */
public void process() {
    try {
        stampedeLog = getScheduler(this.getParent()).stampedeLog;
        toolLog.info("RUNNING " + getQualifiedToolName());

        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("\"");
        for (String param : this.getParameterNames()) {
            stringBuilder.append(param).append(":").append(this.getParameter(param)).append(",");
        }
        stringBuilder.append("\"");

        //            String hostname;
        //            try {
        //                hostname = Inet4Address.getLocalHost().getHostName();
        //            } catch (UnknownHostException e) {
        //                hostname = "localhost";
        //            }

        Scheduler scheduler = this.getScheduler(this.getParent());
        if (scheduler != null) {

            //                logToSchedulerLogger(scheduler.addSchedJobInstDetails(new StampedeEvent(LogDetail.JOB_START)
            //                        .add(LogDetail.STD_OUT_FILE, scheduler.runtimeFileLog.getLogFilePath())
            //                        .add(LogDetail.STD_ERR_FILE, scheduler.runtimeFileLog.getLogFilePath()),
            //                        this));

            stampedeLog.logInvocationStart(this);

            //                logToSchedulerLogger(scheduler.stampedeLog.addBaseEventDetails(new StampedeEvent(LogDetail.INVOCATION_START)
            //                        .add(LogDetail.UNIT_INST_ID, String.valueOf(scheduler.stampedeLog.getTaskNumber(this)))
            //                        .add(LogDetail.UNIT_ID, this.getQualifiedToolName())
            //                        .add(LogDetail.INVOCATION_ID, "1")));
        }

        long startTime = new Date().getTime() / 1000;

        waitPause();
        try {

            unit.process();
        } catch (Exception except) {
            System.out.println(this.getToolName() + " : " + this.getExecutionState().name());
            notifyError(except);
            toolLog.warn("Exception thrown invoking process() on Unit:", except);
        }

        if (scheduler != null) {

            //                logToSchedulerLogger(scheduler.stampedeLog.addSchedJobInstDetails(new StampedeEvent(LogDetail.JOB_TERM)
            //                        .add(LogDetail.STATUS, "0"),
            //                        this)
            //                );
            long duration = (new Date().getTime() / 1000) - startTime;
            if (duration == 0) {
                duration = 1;
            }

            stampedeLog.logInvocationEnd(this, stringBuilder.toString().replaceAll("[\n\r]", ""), startTime,
                    duration);

            stampedeLog.logJobTerminate(this);

            //                StampedeEvent invEnd = new StampedeEvent(LogDetail.INVOCATION_END);
            //                scheduler.stampedeLog.addBaseEventDetails(invEnd)
            //                        .add(LogDetail.UNIT_INST_ID, String.valueOf(scheduler.stampedeLog.getTaskNumber(this)))
            //                        .add(LogDetail.INVOCATION_ID, "1")
            //                        .add(LogDetail.UNIT_ID, "unit:" + this.getQualifiedToolName())
            //                        .add(LogDetail.START_TIME, String.valueOf(startTime))
            //                        .add(LogDetail.DURATION, String.valueOf(duration))
            //                        .add(LogDetail.TRANSFORMATION, this.getQualifiedTaskName())
            //                        .add(LogDetail.EXECUTABLE, "Triana")
            //                        .add(LogDetail.ARGS, stringBuilder.toString().replaceAll("[\n\r]", ""))
            //                        .add(LogDetail.TASK_ID, this.getQualifiedTaskName()
            //                        );

            stampedeLog.logHost(this);
            //                logToSchedulerLogger(scheduler.stampedeLog.addBaseJobInstDetails(new StampedeEvent(LogDetail.HOST), this)
            //                        .add(LogDetail.SITE, "localhost")
            //                        .add(LogDetail.HOSTNAME, hostname)
            //                        .add(LogDetail.IP_ADDRESS, "127.0.0.1")
            //                );

            //                StampedeEvent endJob = new StampedeEvent(LogDetail.JOB_END);
            //                scheduler.addSchedJobInstDetails(endJob, this)
            //                        .add(LogDetail.STD_OUT_FILE, scheduler.runtimeFileLog.getLogFilePath())
            //                        .add(LogDetail.STD_ERR_FILE, scheduler.runtimeFileLog.getLogFilePath())
            //                        .add(LogDetail.SITE, hostname)
            //                        .add(LogDetail.MULTIPLIER, "1");

            if (!getExecutionState().equals(ExecutionState.ERROR)) {
                toolLog.info("FINISHED RUNNING " + getQualifiedToolName());
                ////                    endJob.add(LogDetail.STATUS, "-1");
                ////                    endJob.add(LogDetail.EXIT_CODE, "1");
                //                    invEnd.add(LogDetail.EXIT_CODE, "0");
                //
            } else {
                ////                    endJob.add(LogDetail.STATUS, "0");
                ////                    endJob.add(LogDetail.EXIT_CODE, "0");
                //                    invEnd.add(LogDetail.EXIT_CODE, "1");
            }
            //
            //                logToSchedulerLogger(invEnd);
            //                logToSchedulerLogger(endJob);
        }

    } catch (OutOfRangeException ore) {
        notifyError(ore);
    } catch (EmptyingException ee) {
    } catch (NotCompatibleException nce) {
        notifyError(nce);
    } catch (OutOfMemoryError ep) {
        notifyError(ep);
        System.runFinalization();
        System.gc();
    } catch (Throwable e) {
        notifyError(e);
    }
}

From source file:org.xwoot.jxta.JxtaPeer.java

/** {@inheritDoc} **/
public void leavePeerGroup(PeerGroup oldGroup) throws PeerGroupException {

    this.logger.debug("Leaving peer group: " + oldGroup);

    if (oldGroup == null) {
        this.logger.warn("Null group provided. Ignoring request.");
        return;/* w  ww. ja va  2  s.  co  m*/
    }

    // If not connected to the network there is nothing to leave from.
    if (!this.isConnectedToNetwork()) {
        this.logger.warn("Not connected to network. Ignoring request.");
        return;
    }

    // See if it's the default group. Don`t think you can leave that.
    if (oldGroup.getPeerGroupID().equals(this.rootGroup.getPeerGroupID())) {
        this.logger.warn("Asked to leave the default NetPeerGroup. Ignoring request.");
        return;
    }

    // Stop being rdv for the gorup.
    RendezVousService oldGroupRendezvousService = oldGroup.getRendezVousService();
    oldGroupRendezvousService.stopRendezVous();

    // Resign from the group.
    MembershipService oldGroupMembershipService = oldGroup.getMembershipService();
    oldGroupMembershipService.resign();

    // Stop listening to rendezvous events.
    oldGroupRendezvousService.removeListener(this);

    // Stop listening to discovery events.
    DiscoveryService oldGroupDiscoveryService = oldGroup.getDiscoveryService();
    oldGroupDiscoveryService.removeDiscoveryListener(this);

    try {
        this.closeExistingDirectCommunicationServerSocket();
    } catch (IOException e) {
        // This will never happen in the current implementation but it's best to be sure.
        // Just log it.
        this.logger.warn("Failed to close existing direct communciation server socket after leaving a group.",
                e);
    }

    // See if it was the current joined group.
    if (this.currentJoinedGroup != null
            && oldGroup.getPeerGroupID().equals(this.currentJoinedGroup.getPeerGroupID())) {
        this.currentJoinedGroup = this.rootGroup;
    }

    // Clean the local cache for this group.
    this.flushExistingAdvertisements(oldGroup, DiscoveryService.PEER);
    this.flushExistingAdvertisements(oldGroup, DiscoveryService.ADV);

    // Stop peer presence task.
    this.presenceTask.cancel();
    this.timer.purge();

    // Stop group services and free used memory
    oldGroup.stopApp();
    oldGroup.unref();
    oldGroup = null;

    // Dispose of the the JxtaCast instance.
    this.jc.setPeerGroup(null);
    this.jc = null;

    System.runFinalization();
    System.gc();
}

From source file:gov.anl.cue.arcane.engine.matrix.MatrixModel.java

/**
 * Run the matrix model.//ww  w  .  j  ava2s  .co  m
 *
 * @return the double
 */
public Double runMatrixModel() {

    // Create a results holder.
    Double results = Double.NaN;

    // Attempt to run the model.
    try {

        // Setup a temporary class loader.
        URL[] urls = new URL[] { new File(Util.TEMP_DIR).toURI().toURL() };
        URLClassLoader classLoader = new URLClassLoader(urls, null, null);

        // Attempt to load the compiled file.
        @SuppressWarnings("rawtypes")
        Constructor constructor = classLoader
                .loadClass(MatrixModel.PACKAGE_NAME + "." + MatrixModel.CONCRETE_CLASS_NAME)
                .getDeclaredConstructor(double.class);
        constructor.setAccessible(true);
        Object object = constructor.newInstance(this.stepSize);

        // Call "matrixFormulation.step(steps)".
        Method method = object.getClass().getSuperclass().getMethod("step", int.class);
        method.invoke(object, this.stepCount);

        // Call matrixFormulation.calculateFitnessValue();
        method = object.getClass().getSuperclass().getMethod("calculateFitnessValue");
        results = (Double) method.invoke(object);

        // Clear the given class loader, which should not be
        // a child of another class loader.
        object = null;
        method = null;
        classLoader.close();
        ResourceBundle.clearCache(classLoader);
        classLoader = null;
        Introspector.flushCaches();
        System.runFinalization();
        System.gc();

        // Catch exceptions.
    } catch (Exception e) {

        // Return the default result.
        results = Double.NaN;

    }

    // Return the results.
    return results;

}

From source file:org.allcolor.yahp.converter.CClassLoader.java

/**
 * Destroy instance variables.//from  w  w w . j a  va  2s  .  c o  m
 * 
 * @param logFactoryRelease
 *            method to release commons logging
 */
private final void _destroy(final Method logFactoryRelease) {
    for (final Iterator it = this.childrenMap.entrySet().iterator(); it.hasNext();) {
        final Map.Entry entry = (Map.Entry) it.next();
        final CClassLoader loader = (CClassLoader) entry.getValue();
        loader._destroy(logFactoryRelease);
        it.remove();
    }

    try {
        // remove ref from commons logging
        logFactoryRelease.invoke(null, new Object[] { this });
    } catch (final Exception e) {
    }

    try {
        // reset parent to system class loader
        final Field parent = ClassLoader.class.getDeclaredField("parent");
        parent.setAccessible(true);
        parent.set(this, ClassLoader.getSystemClassLoader());
        parent.setAccessible(false);
    } catch (final Throwable ignore) {
    }

    this.classesMap.clear();
    for (final Iterator it = this.dllMap.entrySet().iterator(); it.hasNext();) {
        final Object element = it.next();
        final Map.Entry entry = (Map.Entry) element;
        if (entry.getValue() instanceof File) {
            ((File) entry.getValue()).delete();
        }
    }
    this.cacheMap.clear();
    this.dllMap.clear();
    this.resourcesMap.clear();
    this.config = null;
    this.name = null;
    this.finalizepath = this.path;
    this.path = null;
    //classes
    System.runFinalization();
    System.gc();
}