Class StrategyServiceImpl.RunningStrategy

    • Field Detail

      • jarFile

        private final File jarFile
        JAR file that contains the strategy to run
      • strategyInstance

        private final StrategyInstance strategyInstance
        strategy instance associated with the running strategy
      • newClassloader

        private URLClassLoader newClassloader
        class loader used for the strategy
      • newContext

        private org.springframework.context.annotation.AnnotationConfigApplicationContext newContext
        new application context used for the strategy
    • Constructor Detail

      • RunningStrategy

        private RunningStrategy​(StrategyInstance inStrategyInstance,
                                File inStrategyJar)
        Create a new RunningStrategy instance.
        Parameters:
        inStrategyInstance - a StrategyInstance value
        inStrategyJar - a File value
    • Method Detail

      • start

        private void start()
                    throws Throwable
        Start the strategy.
        Throws:
        Throwable - if an error occurs loading or starting the strategy.
      • stop

        private void stop()
        Stop the running strategy.
      • getMainClassName

        private String getMainClassName​(File inJarFile)
                                 throws FileNotFoundException,
                                        IOException
        Determines the main class name from the given JAR.

        The current implementation optimistically assumes the given File is a JAR and contains a Main-Class attribute.

        Parameters:
        inJarFile - a File value
        Returns:
        a String value or null if the appropriate attribute cannot be extracted from the given file
        Throws:
        FileNotFoundException - if the file does not exist
        IOException - if the file could otherwise not be read