org.apache.jmeter.gui.action

## Class Restart

- java.lang.Object
- - org.apache.jmeter.gui.action.AbstractAction
  - - org.apache.jmeter.gui.action.AbstractActionWithNoRunningTest
    - - org.apache.jmeter.gui.action.Restart

- All Implemented Interfaces:
    Command, MenuCreator

      public class Restart
      extends AbstractActionWithNoRunningTest
      implements MenuCreator

  Restart JMeter Based on https://dzone.com/articles/programmatically-restart-java
  Since:
    5.0

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.apache.jmeter.gui.plugin.MenuCreator

      `MenuCreator.MENU_LOCATION`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `SUN_JAVA_COMMAND` Sun property pointing the main class and its arguments.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Restart()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `doActionAfterCheck(ActionEvent e)` Called to handle `ActionEvent` only if no test is running
    `Set<String>` | `getActionNames()`
    `JMenuItem[]` | `getMenuItemsAtLocation(MenuCreator.MENU_LOCATION location)` MenuItems to be added in location menu
    `JMenu[]` | `getTopLevelMenus()`
    `void` | `localeChanged()` Update Top Level menu on Locale Change
    `boolean` | `localeChanged(MenuElement menu)`
    `static void` | `restartApplication(Runnable runBeforeRestart)` Restart the current Java application

    - ### Methods inherited from class org.apache.jmeter.gui.action.AbstractActionWithNoRunningTest

      `doAction`

    - ### Methods inherited from class org.apache.jmeter.gui.action.AbstractAction

      `getParentFrame, popupCheckExistingFileListener, popupShouldSave`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### SUN_JAVA_COMMAND

          public static final String SUN_JAVA_COMMAND

      Sun property pointing the main class and its arguments. Might not be defined on non Hotspot VM implementations.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### Restart

          public Restart()

  - ### Method Detail

    - #### doActionAfterCheck

          public void doActionAfterCheck(ActionEvent e)

      Description copied from class: `AbstractActionWithNoRunningTest`
      Called to handle `ActionEvent` only if no test is running
      Specified by:
        `doActionAfterCheck` in class `AbstractActionWithNoRunningTest`
      Parameters:
        `e` - `ActionEvent`
      See Also:
        `Command.doAction(ActionEvent)`

    - #### restartApplication

          public static void restartApplication(Runnable runBeforeRestart)

      Restart the current Java application
      Parameters:
        `runBeforeRestart` - some custom code to be run before restarting

    - #### getActionNames

          public Set<String> getActionNames()

      Specified by:
        `getActionNames` in interface `Command`
      See Also:
        `Command.getActionNames()`

    - #### getMenuItemsAtLocation

          public JMenuItem[] getMenuItemsAtLocation(MenuCreator.MENU_LOCATION location)

      Description copied from interface: `MenuCreator`
      MenuItems to be added in location menu
      Specified by:
        `getMenuItemsAtLocation` in interface `MenuCreator`
      Parameters:
        `location` - in top menu
      Returns:
        array of `JMenuItem`

    - #### getTopLevelMenus

          public JMenu[] getTopLevelMenus()

      Specified by:
        `getTopLevelMenus` in interface `MenuCreator`
      Returns:
        array of JMenu to be put as top level menu between Options and Help

    - #### localeChanged

          public boolean localeChanged(MenuElement menu)

      Specified by:
        `localeChanged` in interface `MenuCreator`
      Parameters:
        `menu` - MenuElement
      Returns:
        true if menu was concerned by Locale change

    - #### localeChanged

          public void localeChanged()

      Description copied from interface: `MenuCreator`
      Update Top Level menu on Locale Change
      Specified by:
        `localeChanged` in interface `MenuCreator`

Copyright © 1998-2021 Apache Software Foundation. All Rights Reserved.