forked from Topshelf/Topshelf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added configuration for start and stop timeout
- Loading branch information
1 parent
84340ff
commit d1a1897
Showing
4 changed files
with
148 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
src/Topshelf.Extensions.Configuration/Options/StartTimeoutOption.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright 2007-2014 Chris Patterson, Dru Sellers, Travis Smith, et. al. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use | ||
// this file except in compliance with the License. You may obtain a copy of the | ||
// License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software distributed | ||
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
// CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations under the License. | ||
namespace Topshelf.Options | ||
{ | ||
using Topshelf.HostConfigurators; | ||
|
||
/// <summary> | ||
/// Represents an option to set a service start timeout (in seconds). | ||
/// </summary> | ||
/// <seealso cref="Option" /> | ||
internal class StartTimeoutOption | ||
: Option | ||
{ | ||
/// <summary> | ||
/// The start timeout (in seconds). | ||
/// </summary> | ||
private readonly int startTimeout; | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="StartTimeoutOption"/> class. | ||
/// </summary> | ||
/// <param name="startTimeout">The start timeout (in seconds).</param> | ||
public StartTimeoutOption(int startTimeout) | ||
{ | ||
this.startTimeout = startTimeout; | ||
} | ||
|
||
/// <summary> | ||
/// Applies the option to the specified host configurator. | ||
/// </summary> | ||
/// <param name="configurator">The host configurator.</param> | ||
public void ApplyTo(HostConfigurator configurator) | ||
{ | ||
configurator.SetStartTimeout(System.TimeSpan.FromSeconds(this.startTimeout)); | ||
} | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
src/Topshelf.Extensions.Configuration/Options/StopTimeoutOption.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright 2007-2014 Chris Patterson, Dru Sellers, Travis Smith, et. al. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use | ||
// this file except in compliance with the License. You may obtain a copy of the | ||
// License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software distributed | ||
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
// CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations under the License. | ||
namespace Topshelf.Options | ||
{ | ||
using Topshelf.HostConfigurators; | ||
|
||
/// <summary> | ||
/// Represents an option to set a service stop timeout (in seconds). | ||
/// </summary> | ||
/// <seealso cref="Option" /> | ||
internal class StopTimeoutOption | ||
: Option | ||
{ | ||
/// <summary> | ||
/// The stop timeout (in seconds). | ||
/// </summary> | ||
private readonly int stopTimeoout; | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="StopTimeoutOption"/> class. | ||
/// </summary> | ||
/// <param name="stopTimeoout">The stop timeout (in seconds).</param> | ||
public StopTimeoutOption(int stopTimeoout) | ||
{ | ||
this.stopTimeoout = stopTimeoout; | ||
} | ||
|
||
/// <summary> | ||
/// Applies the option to the specified host configurator. | ||
/// </summary> | ||
/// <param name="configurator">The host configurator.</param> | ||
public void ApplyTo(HostConfigurator configurator) | ||
{ | ||
configurator.SetStopTimeout(System.TimeSpan.FromSeconds(this.stopTimeoout)); | ||
} | ||
} | ||
} |