Package com.google.appengine.api.modules
Interface ModulesService
public interface ModulesService
ModulesService allows the application to fetch information about its
own module and version information. Additionally, the service has the
ability to start, stop and change the number of instances associated with a
module version.
-
Method Summary
Modifier and TypeMethodDescriptionGet the id of the current instance.Get the name of the current module.Get the name of the current version.getDefaultVersion
(String module) Returns the name of the default version for the module.getInstanceHostname
(String module, String version, String instance) Returns a host name to use for the given module, version and instance.Get the set of modules that are available to the application.int
getNumInstances
(String module, String version) Returns the number of instances that are available to the given manual scaling module version.getVersionHostname
(String module, String version) Returns a host name to use for the given module and version.getVersions
(String module) Returns the set of versions that are available to the given module.void
setNumInstances
(String module, String version, long instances) Set the number of instances that are available to the given manual scaling module version.setNumInstancesAsync
(String module, String version, long instances) Starts an asynchronous call tosetNumInstances(java.lang.String, java.lang.String, long)
and returns aFuture
to obtain its eventual result.void
startVersion
(String module, String version) Starts the given manual scaling or basic scaling module version.startVersionAsync
(String module, String version) Starts an asynchronous call tostartVersion(java.lang.String, java.lang.String)
and returns aFuture
to obtain its eventual result.void
stopVersion
(String module, String version) Stops the given manual scaling or basic scaling module version.stopVersionAsync
(String module, String version) Starts an asynchronous call tostopVersion(java.lang.String, java.lang.String)
and returns aFuture
to obtain its eventual result.
-
Method Details
-
getCurrentModule
String getCurrentModule()Get the name of the current module. ("default" if modules are not enabled for this app)- Returns:
- the name of the module
-
getCurrentVersion
String getCurrentVersion()Get the name of the current version.- Returns:
- the name of the version
-
getCurrentInstanceId
String getCurrentInstanceId()Get the id of the current instance.- Returns:
- current instance id
-
getModules
Get the set of modules that are available to the application.- Returns:
- Set of modules available to the application
- Throws:
ModulesException
- whenModulesService
fails to perform the requested operation.
-
getVersions
Returns the set of versions that are available to the given module.- Parameters:
module
- the name of the module or null for the current module- Throws:
ModulesException
- whenModulesService
fails to perform the requested operation.
-
getDefaultVersion
Returns the name of the default version for the module.- Parameters:
module
- the name of the module or null for the current module- Throws:
ModulesException
- whenModulesService
fails to perform the requested operation.
-
getNumInstances
Returns the number of instances that are available to the given manual scaling module version.- Parameters:
module
- the name of the module or null for the current moduleversion
- the name of the version or null for the current version- Throws:
ModulesException
- whenModulesService
fails to perform the requested operation.
-
setNumInstances
Set the number of instances that are available to the given manual scaling module version. Changing the number of instances is an asynchronous process so this may return before added instances begin serving or removed instances stop serving.- Parameters:
module
- the name of the module or null for the current moduleversion
- the name of the version or null for the current versioninstances
- the number of instances to set- Throws:
ModulesException
- when the requested number of instances is not supported orModulesService
fails to perform the requested operation for some other reason.
-
setNumInstancesAsync
Starts an asynchronous call tosetNumInstances(java.lang.String, java.lang.String, long)
and returns aFuture
to obtain its eventual result. When the returnedFuture
yields a successful resultModulesService
will have successfully initiated the process of setting the number of instances. There may be some delay before added instances start serving or removed instances stop serving. -
startVersion
Starts the given manual scaling or basic scaling module version. Starting a version is an asynchronous process so this may return before the started version is serving. If the requested module version is already started this returns without error.- Parameters:
module
- the name of the moduleversion
- the name of the version- Throws:
ModulesException
- whenModulesService
fails to perform the requested operation.
-
startVersionAsync
Starts an asynchronous call tostartVersion(java.lang.String, java.lang.String)
and returns aFuture
to obtain its eventual result. When the returnedFuture
yields a successful resultModulesService
will have successfully initiated the process of starting the requested version. There may be some delay before the version starts serving. -
stopVersion
Stops the given manual scaling or basic scaling module version. Stopping a version is an asynchronous process so this may return before the stopped version stops serving. If the requested module version is already stopped this returns without error.- Parameters:
module
- the name of the module or null for the current moduleversion
- the name of the version or null for the current version- Throws:
ModulesException
- whenModulesService
fails to perform the requested operation.
-
stopVersionAsync
Starts an asynchronous call tostopVersion(java.lang.String, java.lang.String)
and returns aFuture
to obtain its eventual result. When the returnedFuture
yields a successful resultModulesService
will have successfully initiated the process of stopping the requested version. There may be some delay before the version stops serving. -
getVersionHostname
Returns a host name to use for the given module and version.- Parameters:
module
- the name of the module or null to indicate the current moduleversion
- the name of the version or null to indicate the current version- Throws:
ModulesException
- whenModulesService
fails to perform the requested operation.
-
getInstanceHostname
Returns a host name to use for the given module, version and instance.- Parameters:
module
- the name of the module or null to indicate the current moduleversion
- the name of the version or null to indicate the current versioninstance
- the id of a particular instance to address- Returns:
- the hostname of the given instance
- Throws:
ModulesException
- whenModulesService
fails to perform the requested operation.
-