This is an automated email from the ASF dual-hosted git repository. matthiasblaesing pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/netbeans.git
The following commit(s) were added to refs/heads/master by this push: new 39c1a97 Parameterize Tomcat startup/shutdown timeouts. new f47ca71 Merge pull request #3915 from peedeeboy/feature/tomcat_startup_timeout_parameter 39c1a97 is described below commit 39c1a97d2f879669121b081d73c82bc71b14b89a Author: Pete Whelpton <peedee...@gmail.com> AuthorDate: Fri Apr 1 17:53:48 2022 +0100 Parameterize Tomcat startup/shutdown timeouts. Closes: #3898 --- .../modules/tomcat5/customizer/Bundle.properties | 4 + .../tomcat5/customizer/CustomizerDataSupport.java | 40 ++++++++ .../tomcat5/customizer/CustomizerStartup.form | 102 ++++++++++++++++++--- .../tomcat5/customizer/CustomizerStartup.java | 71 ++++++++++++-- .../modules/tomcat5/optional/StartTomcat.java | 17 +++- .../modules/tomcat5/util/TomcatProperties.java | 40 ++++++++ 6 files changed, 250 insertions(+), 24 deletions(-) diff --git a/enterprise/tomcat5/src/org/netbeans/modules/tomcat5/customizer/Bundle.properties b/enterprise/tomcat5/src/org/netbeans/modules/tomcat5/customizer/Bundle.properties index bd8889b..91c7be4 100644 --- a/enterprise/tomcat5/src/org/netbeans/modules/tomcat5/customizer/Bundle.properties +++ b/enterprise/tomcat5/src/org/netbeans/modules/tomcat5/customizer/Bundle.properties @@ -237,3 +237,7 @@ CustomizerDeployment.deplolymentTimeoutSpinner.accessible.description=Deployment CustomizerDeployment.deplolymentTimeoutLabel.tooltip=Time to wait before assuming a deployment has failed CustomizerDeployment.deplolymentTimeoutSpinner.tooltip=Time to wait before assuming a deployment has failed + +CustomizerStartup.timeoutsLabel.txt=Timeouts [s]\: +CustomizerStartup.startupTimeout.label=Startup: +CustomizerStartup.shutdownTimeout.label=Shutdown: \ No newline at end of file diff --git a/enterprise/tomcat5/src/org/netbeans/modules/tomcat5/customizer/CustomizerDataSupport.java b/enterprise/tomcat5/src/org/netbeans/modules/tomcat5/customizer/CustomizerDataSupport.java index 32b311c..87f03ee 100644 --- a/enterprise/tomcat5/src/org/netbeans/modules/tomcat5/customizer/CustomizerDataSupport.java +++ b/enterprise/tomcat5/src/org/netbeans/modules/tomcat5/customizer/CustomizerDataSupport.java @@ -74,6 +74,8 @@ public class CustomizerDataSupport { private SpinnerNumberModel shutdownPortModel; private SpinnerNumberModel debugPortModel; private SpinnerNumberModel deploymentTimeoutModel; + private SpinnerNumberModel startupTimeoutModel; + private SpinnerNumberModel shutdownTimeoutModel; private ButtonModel driverDeploymentModel; // model dirty flags @@ -97,6 +99,8 @@ public class CustomizerDataSupport { private boolean debugPortModelFlag; private boolean deploymentTimeoutModelFlag; private boolean driverDeploymentModelFlag; + private boolean startupTimeoutModelFlag; + private boolean shutdownTimeoutModelFlag; private TomcatProperties tp; private TomcatManager tm; @@ -315,6 +319,24 @@ public class CustomizerDataSupport { store(); // This is just temporary until the server manager has OK and Cancel buttons } }); + + // startupTimeoutModel + startupTimeoutModel = new SpinnerNumberModel(tp.getStartupTimeout(), 1, Integer.MAX_VALUE, 1); + startupTimeoutModel.addChangeListener(new ModelChangeAdapter() { + public void modelChanged() { + startupTimeoutModelFlag = true; + store(); // This is just temporary until the server manager has OK and Cancel buttons + } + }); + + // shutdownTimeoutModel + shutdownTimeoutModel = new SpinnerNumberModel(tp.getShutdownTimeout(), 1, Integer.MAX_VALUE, 1); + shutdownTimeoutModel.addChangeListener(new ModelChangeAdapter() { + public void modelChanged() { + shutdownTimeoutModelFlag = true; + store(); // This is just temporary until the server manager has OK and Cancel buttons + } + }); } @@ -444,6 +466,14 @@ public class CustomizerDataSupport { return deploymentTimeoutModel; } + public SpinnerNumberModel getStartupTimeoutModel() { + return startupTimeoutModel; + } + + public SpinnerNumberModel getShutdownTimeoutModel() { + return shutdownTimeoutModel; + } + public ButtonModel getDriverDeploymentModel() { return driverDeploymentModel; } @@ -554,6 +584,16 @@ public class CustomizerDataSupport { tp.setDriverDeployment(driverDeploymentModel.isSelected()); driverDeploymentModelFlag = false; } + + if (startupTimeoutModelFlag) { + tp.setStartupTimeout((Integer)startupTimeoutModel.getValue()); + startupTimeoutModelFlag = false; + } + + if (shutdownTimeoutModelFlag) { + tp.setShutdownTimeout((Integer)shutdownTimeoutModel.getValue()); + shutdownTimeoutModelFlag = false; + } } /** Create a Document initialized by the specified text parameter, which may be null */ diff --git a/enterprise/tomcat5/src/org/netbeans/modules/tomcat5/customizer/CustomizerStartup.form b/enterprise/tomcat5/src/org/netbeans/modules/tomcat5/customizer/CustomizerStartup.form index b1ae6c4..ec6f4d9 100644 --- a/enterprise/tomcat5/src/org/netbeans/modules/tomcat5/customizer/CustomizerStartup.form +++ b/enterprise/tomcat5/src/org/netbeans/modules/tomcat5/customizer/CustomizerStartup.form @@ -21,13 +21,15 @@ --> -<Form version="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> +<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <NonVisualComponents> <Component class="javax.swing.ButtonGroup" name="buttonGroup1"> </Component> </NonVisualComponents> <AuxValues> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/> <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> @@ -84,12 +86,12 @@ </Component> <Component class="javax.swing.JCheckBox" name="jCheckBox1"> <Properties> - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> - <ResourceString bundle="org/netbeans/modules/tomcat5/customizer/Bundle.properties" key="TXT_CustomScript" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> - </Property> <Property name="model" type="javax.swing.ButtonModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> <Connection code="custData.getCustomScriptModel()" type="code"/> </Property> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="org/netbeans/modules/tomcat5/customizer/Bundle.properties" key="TXT_CustomScript" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + </Property> </Properties> <AccessibilityProperties> <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> @@ -133,12 +135,12 @@ </Component> <Component class="javax.swing.JCheckBox" name="jCheckBox4"> <Properties> - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> - <ResourceString bundle="org/netbeans/modules/tomcat5/customizer/Bundle.properties" key="TXT_ForceShutdown" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> - </Property> <Property name="model" type="javax.swing.ButtonModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> <Connection code="custData.getForceStopModel()" type="code"/> </Property> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="org/netbeans/modules/tomcat5/customizer/Bundle.properties" key="TXT_ForceShutdown" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + </Property> </Properties> <AccessibilityProperties> <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> @@ -159,15 +161,15 @@ </Component> <Component class="javax.swing.JRadioButton" name="jRadioButton1"> <Properties> + <Property name="model" type="javax.swing.ButtonModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> + <Connection code="custData.getSharedMemModel()" type="code"/> + </Property> <Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor"> <ComponentRef name="buttonGroup1"/> </Property> <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> <ResourceString bundle="org/netbeans/modules/tomcat5/customizer/Bundle.properties" key="TXT_SharedMemName" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> </Property> - <Property name="model" type="javax.swing.ButtonModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> - <Connection code="custData.getSharedMemModel()" type="code"/> - </Property> </Properties> <AccessibilityProperties> <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> @@ -188,15 +190,15 @@ </Component> <Component class="javax.swing.JRadioButton" name="jRadioButton2"> <Properties> + <Property name="model" type="javax.swing.ButtonModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> + <Connection code="custData.getSocketModel()" type="code"/> + </Property> <Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor"> <ComponentRef name="buttonGroup1"/> </Property> <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> <ResourceString bundle="org/netbeans/modules/tomcat5/customizer/Bundle.properties" key="TXT_SocketPort" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> </Property> - <Property name="model" type="javax.swing.ButtonModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> - <Connection code="custData.getSocketModel()" type="code"/> - </Property> </Properties> <AccessibilityProperties> <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> @@ -273,7 +275,7 @@ </AccessibilityProperties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> - <GridBagConstraints gridX="0" gridY="6" gridWidth="0" gridHeight="0" fill="0" ipadX="0" ipadY="0" insetsTop="5" insetsLeft="12" insetsBottom="12" insetsRight="0" anchor="16" weightX="0.0" weightY="1.0"/> + <GridBagConstraints gridX="0" gridY="9" gridWidth="0" gridHeight="0" fill="0" ipadX="0" ipadY="0" insetsTop="5" insetsLeft="12" insetsBottom="12" insetsRight="0" anchor="16" weightX="0.0" weightY="1.0"/> </Constraint> </Constraints> </Component> @@ -295,5 +297,77 @@ </Constraint> </Constraints> </Component> + <Component class="javax.swing.JLabel" name="timeoutsLabel"> + <Properties> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="org/netbeans/modules/tomcat5/customizer/Bundle.properties" key="CustomizerStartup.timeoutsLabel.txt" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + </Property> + </Properties> + <Constraints> + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> + <GridBagConstraints gridX="0" gridY="6" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="11" insetsLeft="12" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/> + </Constraint> + </Constraints> + </Component> + <Component class="javax.swing.JLabel" name="startupTimeoutLabel"> + <Properties> + <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor"> + <ComponentRef name="startupTimeoutSpinner"/> + </Property> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="org/netbeans/modules/tomcat5/customizer/Bundle.properties" key="CustomizerStartup.startupTimeout.label" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + </Property> + </Properties> + <Constraints> + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> + <GridBagConstraints gridX="0" gridY="7" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="5" insetsLeft="34" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/> + </Constraint> + </Constraints> + </Component> + <Component class="javax.swing.JSpinner" name="startupTimeoutSpinner"> + <Properties> + <Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> + <Connection code="custData.getStartupTimeoutModel()" type="code"/> + </Property> + <Property name="editor" type="javax.swing.JComponent" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> + <Connection code="new NumberEditor(startupTimeoutSpinner, "#")" type="code"/> + </Property> + </Properties> + <Constraints> + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> + <GridBagConstraints gridX="2" gridY="7" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="5" insetsLeft="5" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/> + </Constraint> + </Constraints> + </Component> + <Component class="javax.swing.JLabel" name="shutdownTimeoutLabel"> + <Properties> + <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor"> + <ComponentRef name="shutdownTimeoutSpinner"/> + </Property> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="org/netbeans/modules/tomcat5/customizer/Bundle.properties" key="CustomizerStartup.shutdownTimeout.label" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + </Property> + </Properties> + <Constraints> + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> + <GridBagConstraints gridX="0" gridY="8" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="5" insetsLeft="34" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/> + </Constraint> + </Constraints> + </Component> + <Component class="javax.swing.JSpinner" name="shutdownTimeoutSpinner"> + <Properties> + <Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> + <Connection code="custData.getShutdownTimeoutModel()" type="code"/> + </Property> + <Property name="editor" type="javax.swing.JComponent" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> + <Connection code="new NumberEditor(shutdownTimeoutSpinner, "#")" type="code"/> + </Property> + </Properties> + <Constraints> + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> + <GridBagConstraints gridX="2" gridY="8" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="5" insetsLeft="5" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/> + </Constraint> + </Constraints> + </Component> </SubComponents> </Form> diff --git a/enterprise/tomcat5/src/org/netbeans/modules/tomcat5/customizer/CustomizerStartup.java b/enterprise/tomcat5/src/org/netbeans/modules/tomcat5/customizer/CustomizerStartup.java index 8e99d29..b43ec79 100644 --- a/enterprise/tomcat5/src/org/netbeans/modules/tomcat5/customizer/CustomizerStartup.java +++ b/enterprise/tomcat5/src/org/netbeans/modules/tomcat5/customizer/CustomizerStartup.java @@ -23,6 +23,7 @@ import java.io.File; import javax.accessibility.AccessibleContext; import javax.swing.JFileChooser; import javax.swing.JSpinner; +import javax.swing.JSpinner.NumberEditor; import javax.swing.JTextField; import javax.swing.SwingUtilities; import org.openide.util.NbBundle; @@ -82,7 +83,7 @@ public class CustomizerStartup extends javax.swing.JPanel { * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ - // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; @@ -98,6 +99,11 @@ public class CustomizerStartup extends javax.swing.JPanel { browseButton = new javax.swing.JButton(); jLabel2 = new javax.swing.JLabel(); jSpinner1 = new javax.swing.JSpinner(); + timeoutsLabel = new javax.swing.JLabel(); + startupTimeoutLabel = new javax.swing.JLabel(); + startupTimeoutSpinner = new javax.swing.JSpinner(); + shutdownTimeoutLabel = new javax.swing.JLabel(); + shutdownTimeoutSpinner = new javax.swing.JSpinner(); setLayout(new java.awt.GridBagLayout()); @@ -126,8 +132,8 @@ public class CustomizerStartup extends javax.swing.JPanel { jTextField1.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(CustomizerStartup.class, "ASCN_Script")); // NOI18N jTextField1.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(CustomizerStartup.class, "ASCD_Script")); // NOI18N - org.openide.awt.Mnemonics.setLocalizedText(jCheckBox1, org.openide.util.NbBundle.getMessage(CustomizerStartup.class, "TXT_CustomScript")); // NOI18N jCheckBox1.setModel(custData.getCustomScriptModel()); + org.openide.awt.Mnemonics.setLocalizedText(jCheckBox1, org.openide.util.NbBundle.getMessage(CustomizerStartup.class, "TXT_CustomScript")); // NOI18N jCheckBox1.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { jCheckBox1StateChanged(evt); @@ -154,8 +160,8 @@ public class CustomizerStartup extends javax.swing.JPanel { jLabel4.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(CustomizerStartup.class, "ACSN_DebugTrans")); // NOI18N jLabel4.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(CustomizerStartup.class, "ACSN_DebugTrans")); // NOI18N - org.openide.awt.Mnemonics.setLocalizedText(jCheckBox4, org.openide.util.NbBundle.getMessage(CustomizerStartup.class, "TXT_ForceShutdown")); // NOI18N jCheckBox4.setModel(custData.getForceStopModel()); + org.openide.awt.Mnemonics.setLocalizedText(jCheckBox4, org.openide.util.NbBundle.getMessage(CustomizerStartup.class, "TXT_ForceShutdown")); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; @@ -166,9 +172,9 @@ public class CustomizerStartup extends javax.swing.JPanel { jCheckBox4.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(CustomizerStartup.class, "ASCN_ForceStop")); // NOI18N jCheckBox4.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(CustomizerStartup.class, "ASCD_ForceStop")); // NOI18N + jRadioButton1.setModel(custData.getSharedMemModel()); buttonGroup1.add(jRadioButton1); org.openide.awt.Mnemonics.setLocalizedText(jRadioButton1, org.openide.util.NbBundle.getMessage(CustomizerStartup.class, "TXT_SharedMemName")); // NOI18N - jRadioButton1.setModel(custData.getSharedMemModel()); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 4; @@ -179,9 +185,9 @@ public class CustomizerStartup extends javax.swing.JPanel { jRadioButton1.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(CustomizerStartup.class, "ACSN_SharedMem")); // NOI18N jRadioButton1.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(CustomizerStartup.class, "ACSD_SharedMem")); // NOI18N + jRadioButton2.setModel(custData.getSocketModel()); buttonGroup1.add(jRadioButton2); org.openide.awt.Mnemonics.setLocalizedText(jRadioButton2, org.openide.util.NbBundle.getMessage(CustomizerStartup.class, "TXT_SocketPort")); // NOI18N - jRadioButton2.setModel(custData.getSocketModel()); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 5; @@ -222,7 +228,7 @@ public class CustomizerStartup extends javax.swing.JPanel { org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(CustomizerStartup.class, "TXT_NoteChangesTakeAffect")); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 6; + gridBagConstraints.gridy = 9; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST; @@ -232,7 +238,7 @@ public class CustomizerStartup extends javax.swing.JPanel { jLabel2.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(CustomizerStartup.class, "ASCN_Note")); // NOI18N jLabel2.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(CustomizerStartup.class, "ASCD_Note")); // NOI18N - jSpinner1.setFont(new java.awt.Font("Dialog", 0, 12)); + jSpinner1.setFont(new java.awt.Font("Dialog", 0, 12)); // NOI18N jSpinner1.setModel(custData.getDebugPortModel()); jSpinner1.setEditor(new JSpinner.NumberEditor(jSpinner1, "#")); gridBagConstraints = new java.awt.GridBagConstraints(); @@ -241,6 +247,52 @@ public class CustomizerStartup extends javax.swing.JPanel { gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 0); add(jSpinner1, gridBagConstraints); + + org.openide.awt.Mnemonics.setLocalizedText(timeoutsLabel, org.openide.util.NbBundle.getMessage(CustomizerStartup.class, "CustomizerStartup.timeoutsLabel.txt")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 6; + gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.insets = new java.awt.Insets(11, 12, 0, 0); + add(timeoutsLabel, gridBagConstraints); + + startupTimeoutLabel.setLabelFor(startupTimeoutSpinner); + org.openide.awt.Mnemonics.setLocalizedText(startupTimeoutLabel, org.openide.util.NbBundle.getMessage(CustomizerStartup.class, "CustomizerStartup.startupTimeout.label")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 7; + gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.insets = new java.awt.Insets(5, 34, 0, 0); + add(startupTimeoutLabel, gridBagConstraints); + + startupTimeoutSpinner.setModel(custData.getStartupTimeoutModel()); + startupTimeoutSpinner.setEditor(new NumberEditor(startupTimeoutSpinner, "#")); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 2; + gridBagConstraints.gridy = 7; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 0); + add(startupTimeoutSpinner, gridBagConstraints); + + shutdownTimeoutLabel.setLabelFor(shutdownTimeoutSpinner); + org.openide.awt.Mnemonics.setLocalizedText(shutdownTimeoutLabel, org.openide.util.NbBundle.getMessage(CustomizerStartup.class, "CustomizerStartup.shutdownTimeout.label")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 8; + gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.insets = new java.awt.Insets(5, 34, 0, 0); + add(shutdownTimeoutLabel, gridBagConstraints); + + shutdownTimeoutSpinner.setModel(custData.getShutdownTimeoutModel()); + shutdownTimeoutSpinner.setEditor(new NumberEditor(shutdownTimeoutSpinner, "#")); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 2; + gridBagConstraints.gridy = 8; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 0); + add(shutdownTimeoutSpinner, gridBagConstraints); }// </editor-fold>//GEN-END:initComponents private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButtonActionPerformed @@ -287,6 +339,11 @@ public class CustomizerStartup extends javax.swing.JPanel { private javax.swing.JSpinner jSpinner1; private javax.swing.JTextField jTextField1; private javax.swing.JTextField jTextField4; + private javax.swing.JLabel shutdownTimeoutLabel; + private javax.swing.JSpinner shutdownTimeoutSpinner; + private javax.swing.JLabel startupTimeoutLabel; + private javax.swing.JSpinner startupTimeoutSpinner; + private javax.swing.JLabel timeoutsLabel; // End of variables declaration//GEN-END:variables } diff --git a/enterprise/tomcat5/src/org/netbeans/modules/tomcat5/optional/StartTomcat.java b/enterprise/tomcat5/src/org/netbeans/modules/tomcat5/optional/StartTomcat.java index b875815..4b3ba71 100644 --- a/enterprise/tomcat5/src/org/netbeans/modules/tomcat5/optional/StartTomcat.java +++ b/enterprise/tomcat5/src/org/netbeans/modules/tomcat5/optional/StartTomcat.java @@ -110,7 +110,7 @@ public final class StartTomcat extends StartServer implements ProgressObject { private static final int MODE_PROFILE = 2; /** For how long should we keep trying to get response from the server. */ - private static final long TIMEOUT_DELAY = 180000; + private static final long DEFAULT_TIMEOUT_DELAY = 180000; private static final Pattern WINDOWS_ESCAPED_JAVA_OPTS = Pattern.compile("^set\\s\"JAVA_OPTS.*$"); @@ -583,8 +583,19 @@ public final class StartTomcat extends StartServer implements ProgressObject { * @return <code>true</code> if START/STOP command completion was verified, * <code>false</code> if time-out ran out. */ - private boolean hasCommandSucceeded() { - long timeout = System.currentTimeMillis() + TIMEOUT_DELAY; + private boolean hasCommandSucceeded() { + long timeout = System.currentTimeMillis(); + + if (command == CommandType.START) { + timeout += tm.getTomcatProperties().getStartupTimeout() * 1000l; + } + else if (command == CommandType.STOP) { + timeout += tm.getTomcatProperties().getShutdownTimeout() * 1000l; + } + else { + timeout += DEFAULT_TIMEOUT_DELAY; + } + while (true) { boolean isRunning = isRunning(); if (command == CommandType.START) { diff --git a/enterprise/tomcat5/src/org/netbeans/modules/tomcat5/util/TomcatProperties.java b/enterprise/tomcat5/src/org/netbeans/modules/tomcat5/util/TomcatProperties.java index a806823..b3db325 100644 --- a/enterprise/tomcat5/src/org/netbeans/modules/tomcat5/util/TomcatProperties.java +++ b/enterprise/tomcat5/src/org/netbeans/modules/tomcat5/util/TomcatProperties.java @@ -124,6 +124,8 @@ public class TomcatProperties { NbBundle.getMessage(TomcatProperties.class, "LBL_DefaultDisplayName"); private static final boolean DEF_VALUE_DRIVER_DEPLOYMENT = true; private static final int DEF_VALUE_DEPLOYMENT_TIMEOUT = 120; + private static final int DEF_VALUE_STARTUP_TIMEOUT = 120; + private static final int DEF_VALUE_SHUTDOWN_TIMEOUT = 120; private TomcatManager tm; private InstanceProperties ip; @@ -594,6 +596,44 @@ public class TomcatProperties { ip.setProperty(InstanceProperties.DEPLOYMENT_TIMEOUT, Integer.toString(timeout)); } + public int getStartupTimeout() { + String val = ip.getProperty(InstanceProperties.STARTUP_TIMEOUT); + if (val != null) { + try { + int timeout = Integer.parseInt(val); + if (timeout >= 1) { + return timeout; + } + } catch (NumberFormatException nfe) { + Logger.getLogger(TomcatProperties.class.getName()).log(Level.INFO, null, nfe); + } + } + return DEF_VALUE_STARTUP_TIMEOUT; + } + + public void setStartupTimeout(int timeout) { + ip.setProperty(InstanceProperties.STARTUP_TIMEOUT, Integer.toString(timeout)); + } + + public int getShutdownTimeout() { + String val = ip.getProperty(InstanceProperties.SHUTDOWN_TIMEOUT); + if (val != null) { + try { + int timeout = Integer.parseInt(val); + if (timeout >= 1) { + return timeout; + } + } catch (NumberFormatException nfe) { + Logger.getLogger(TomcatProperties.class.getName()).log(Level.INFO, null, nfe); + } + } + return DEF_VALUE_SHUTDOWN_TIMEOUT; + } + + public void setShutdownTimeout(int timeout) { + ip.setProperty(InstanceProperties.SHUTDOWN_TIMEOUT, Integer.toString(timeout)); + } + public boolean getDriverDeployment() { String val = ip.getProperty(PROP_DRIVER_DEPLOYMENT); return val != null ? Boolean.valueOf(val) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org For additional commands, e-mail: commits-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists