Interface TopCodeCache

All Known Implementing Classes:
DefaultTopCodeCache

public interface TopCodeCache
Code cache used to compile and cache code for single source instances.

Used to cache individual code layers on top of the LayeredEngine. This top code cache is typically what is used if running a script from the Grengine if the script is not part of static code layers or the top load mode is "current first" and the source in the static code layers has been modified since compilation. Each source gets its own independent bytecode class loader that does not see any code of the other source instances in the top code cache.

Since:
1.0
Author:
Alain Stalder, Made in Switzerland.
  • Method Details

    • getUpToDateCode

      SingleSourceCode getUpToDateCode(Source source)
      gets the code from the cache, recompiling the given source if it had been modified.
      Parameters:
      source - source
      Returns:
      code
      Throws:
      CompileException - if compilation failed
      NullPointerException - if source is null
      Since:
      1.0
    • setParent

      void setParent(ClassLoader parent)
      sets the parent class loader and clears the cache.
      Parameters:
      parent - parent class loader
      Throws:
      NullPointerException - if parent is null
      Since:
      1.0
    • getParent

      ClassLoader getParent()
      gets the parent class loader.
      Returns:
      parent class loader
      Since:
      1.0
    • clear

      void clear()
      clears the cache.
      Since:
      1.0
    • clone

      TopCodeCache clone()
      creates a clone with the same cached bytecode.
      Returns:
      clone
      Since:
      1.0