Class JMadKernelImpl

    • Constructor Detail

      • JMadKernelImpl

        public JMadKernelImpl()
    • Method Detail

      • start

        public void start()
                   throws JMadException
        Description copied from interface: JMadKernel
        starts madx as a separate thread and configures the needed streams.
        Specified by:
        start in interface JMadKernel
        Throws:
        JMadException - if the starting of the MadX process fails
      • stop

        public int stop()
                 throws JMadException
        Description copied from interface: JMadKernel
        stops the madx-thread
        Specified by:
        stop in interface JMadKernel
        Returns:
        the exit-value of madx
        Throws:
        JMadException - if the stopping of the MadX process fails
      • execute

        public Result execute​(JMadExecutable executable)
                       throws JMadException
        Description copied from interface: JMadKernel
        executes a Command or Task, waits for completion (our timeout if set), and returns result, if command/task provides one.
        Specified by:
        execute in interface JMadKernel
        Parameters:
        executable - the command or task to execute
        Returns:
        the result, if available, otherwise null
        Throws:
        JMadException - if the execution fails
      • isMadxRunning

        public boolean isMadxRunning()
        Specified by:
        isMadxRunning in interface JMadKernel
        Returns:
        true, if madx was started before, false otherwise
      • finalize

        protected void finalize()
                         throws java.lang.Throwable
        When the class is destroyed it takes care, that MadX is closed in a proper way.
        Overrides:
        finalize in class java.lang.Object
        Throws:
        java.lang.Throwable - if the finalization fails
      • getTimeout

        public java.lang.Long getTimeout()
        Specified by:
        getTimeout in interface JMadKernelConfig
        Returns:
        the actual set timeout
      • setTimeout

        public void setTimeout​(java.lang.Long timeout)
        sets the actual timeout in ms. If null then the kernel waits forever for Madx.
        Specified by:
        setTimeout in interface JMadKernelConfig
        Parameters:
        timeout - the timeout to set
      • setKeepOutputFile

        public void setKeepOutputFile​(boolean keepOutputFile)
        sets the flag, if the output-file shall be kept or deleted after task/command execution.
        Specified by:
        setKeepOutputFile in interface JMadKernelConfig
        Parameters:
        keepOutputFile - true if the output-file shall be kept, false otherwise
      • isKeepOutputFile

        public boolean isKeepOutputFile()
        Specified by:
        isKeepOutputFile in interface JMadKernelConfig
        Returns:
        true, if the outputfile shall be kept or false if it shall be deleted after command/task execution.
      • setCleanupDirs

        public void setCleanupDirs​(boolean cleanupDirs)
        Description copied from interface: JMadKernelConfig
        enable automatic deletion of JMadKernel tmpDir during shutdown
        Specified by:
        setCleanupDirs in interface JMadKernelConfig
        Parameters:
        cleanupDirs - true if tempDirectory should be deleted
      • isCleanupDirs

        public boolean isCleanupDirs()
        Specified by:
        isCleanupDirs in interface JMadKernelConfig
        Returns:
        true if the JMadKernel tempDirectory is going to be deleted on Shutdown
      • getOutputFile

        public java.io.File getOutputFile()
        Specified by:
        getOutputFile in interface JMadKernel
        Returns:
        the JMadKernel OutputFile
      • setPreferences

        public void setPreferences​(JMadPreferences preferences)
      • setFileUtil

        public void setFileUtil​(TempFileUtil fileUtil)
      • setMadxBin

        public void setMadxBin​(MadxBin madxBin)