Class NashornMemoryWatcher

  • All Implemented Interfaces:
    Runnable

    public class NashornMemoryWatcher
    extends Object
    implements Runnable
    The memory watcher is used to detect memory leaks. If the check interval is to low a high cpu impact is the consequence. if it is to high a program might swallow to much memory and a oom exception occurs.
    Author:
    Tobias Soloschenko
    • Constructor Detail

      • NashornMemoryWatcher

        public NashornMemoryWatcher​(NashornScriptCallable nashornScriptCallable,
                                    Future<Object> scriptTask,
                                    long wait,
                                    TimeUnit unit,
                                    long maxMemoryUsage,
                                    boolean debug,
                                    Writer errorWriter)
        Creates a new memory watcher
        Parameters:
        nashornScriptCallable - the script callable to be watched
        scriptTask - the script task to get the thread of
        wait - how long to wait until the next check
        unit - unit until the next check
        maxMemoryUsage - how much memory should be used as a maximum
        debug - if debug is enabled
        errorWriter - the error writer to output some information
    • Method Detail

      • run

        public void run()
        Specified by:
        run in interface Runnable