Class ServiceConfiguration
java.lang.Object
com.install4j.api.windows.service.ServiceConfiguration
- All Implemented Interfaces:
Serializable
The service configuration passed to
WinServices. If you don't set a property, the original value will be preserved for existing services.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbinaryName(String binaryName) The path to the binary.delayedAutoStart(Boolean delayedAutoStart) If startType is set toAUTO, you can specify with this property that the service is started with a short delay after all other auto-start services.dependencies(String dependencies) A comma-separated list of dependencies.description(String description) An additional description for the servicedisplayName(String displayName) The display name.maxRestarts(int maxRestarts) The maximum number of restarts whenrestartOnFailureis set to true.otherAccountName(String otherAccountName) The service account name to be used.otherAccountPassword(String otherAccountPassword) The service account password to be used.preshutdown(Boolean preshutdown) If set to true, the service will be notified before the system shuts down and has considerably more time to shut down cleanly instead of just a few seconds.preshutdownTimeoutSeconds(Integer preshutdownTimeoutSeconds) The number of seconds the service has to shut down after receiving the pre-shutdown notification, ifpreshutdownis enabled.resetSeconds(int resetSeconds) The time without failure in seconds after which to reset the restart counter configured withmaxRestarts.restartMillis(int restartMillis) The restart period whenrestartOnFailureis set to true.restartOnFailure(Boolean restartOnFailure) If set to true, the service will be restarted after a period defined withrestartMillis(defaults to one second) if it was terminated with an errorserviceAccount(ServiceAccount serviceAccount) The service account to be used.startType(ServiceStartType startType) The start type
-
Constructor Details
-
ServiceConfiguration
public ServiceConfiguration()
-
-
Method Details
-
binaryName
The path to the binary. This can be quoted and contain arguments- Parameters:
binaryName- the binary name- Returns:
- this object
-
displayName
The display name. This is different from the service name which serves as identifier.- Parameters:
displayName- the display name- Returns:
- this object
-
startType
The start type- Parameters:
startType- the start type- Returns:
- this object
-
dependencies
A comma-separated list of dependencies. Ifpreshutdownis enabled and this service is not already listed in the WindowsPreshutdownOrder, it is inserted before the earliest dependency already listed there. If none of its dependencies are listed, the service is appended. Existing entries are preserved.- Parameters:
dependencies- the dependencies- Returns:
- this object
-
description
An additional description for the service- Parameters:
description- the description- Returns:
- this object
-
delayedAutoStart
If startType is set toAUTO, you can specify with this property that the service is started with a short delay after all other auto-start services.- Parameters:
delayedAutoStart-trueif the service start should be delayed- Returns:
- this object
-
preshutdown
If set to true, the service will be notified before the system shuts down and has considerably more time to shut down cleanly instead of just a few seconds. Ifdependenciesare set, the service is added to the WindowsPreshutdownOrderas described independencies(String). This only applies to services generated by install4j.- Parameters:
preshutdown-trueif the service should receive the pre-shutdown notification- Returns:
- this object
- See Also:
-
restartOnFailure
If set to true, the service will be restarted after a period defined withrestartMillis(defaults to one second) if it was terminated with an error- Parameters:
restartOnFailure-trueif a restart should be performed- Returns:
- this object
-
restartMillis
The restart period whenrestartOnFailureis set to true. Defaults to one second.- Parameters:
restartMillis- the restart period in milliseconds- Returns:
- this object
-
maxRestarts
The maximum number of restarts whenrestartOnFailureis set to true. Defaults to 0, which means unlimited restarts. WithresetSecondsyou can define the period after which this counter will be reset. This should be a value between 0 and 2 to fit into the Windows service UI.- Parameters:
maxRestarts- the number of restarts to try- Returns:
- this object
-
resetSeconds
The time without failure in seconds after which to reset the restart counter configured withmaxRestarts. Defaults to 0.- Parameters:
resetSeconds- the time in seconds- Returns:
- this object
-
serviceAccount
The service account to be used. Can be one of the predefined Windows accounts orOTHER. If it isOTHER, you have to specify otherAccountName and otherAccountPassword- Parameters:
serviceAccount- the account to be used- Returns:
- this object
-
otherAccountName
The service account name to be used. The serviceAccount property will be set toOTHERwhen you call this method. The name must be in the form DomainName\UserName. If the account belongs to the built-in domain, you can specify .\UserName.- Parameters:
otherAccountName- the account name or SID- Returns:
- this object
-
otherAccountPassword
The service account password to be used. The serviceAccount property will be set toOTHERwhen you call this method.- Parameters:
otherAccountPassword- the account password- Returns:
- this object
-
preshutdownTimeoutSeconds
The number of seconds the service has to shut down after receiving the pre-shutdown notification, ifpreshutdownis enabled. Defaults to 60 seconds.- Parameters:
preshutdownTimeoutSeconds- the pre-shutdown timeout in seconds- Returns:
- this object
-
getRestartMillis
-
getMaxRestarts
-
getResetSeconds
-