All Packages Class Hierarchy This Package Previous Next Index
Class sun.server.ServerProcess
java.lang.Object
|
+----sun.server.ServerProcess
- public class ServerProcess
- extends Object
- implements Runnable
A ServerProcess represents an OS process and can run one or more
Service instances, each of which is associated with a protocol and a
configuration.
-
ServerProcess()
-
-
getAutoStartServiceNames()
- Get the list of automatically-started service names for a server.
-
getCurrentServerName()
- Get the name of the current server.
-
getDefaultServiceConfiguration(String)
- Get the default configuration for a service in a server.
-
getDescription()
- Get a server description.
-
getOrderedServiceNames()
- Get the order in which to display service names for a server.
-
getProperties()
- Get the properties for a server.
-
getServer(String)
- Get a server instance given its name.
-
getServerNames()
- Get the list of server names.
-
getServerProperties()
- Get the server's properties.
-
getService(String)
- Get a service instance.
-
getServiceConfiguration(String, String)
- Get the configuration for a service in a server.
-
getServiceNames()
- Get the service names for a server.
-
getServiceNames(String)
- Get the list of service names for a server.
-
getThreadGroup(String)
- Get the thread group for a service.
-
isRoot()
-
Checks if the process is being run as (Posix) root.
-
isRunning()
- Find out if the server is running.
-
isServiceRunning(String)
- Check if a service is running in the current server.
-
main(String[])
- Main function
-
restartCurrentServer()
- Restart the current server process.
-
restartServer(String)
- Restart a server process.
-
restartService(String, int)
- Restart a single service in the current server.
-
run()
- Periodically check whether there are any service threads running.
-
setGroup(String)
-
Sets the current group to the specified group name or group id.
-
setUser(String)
-
Sets the current user to the specified user name or user id.
-
startServer(String)
- Start a server process.
-
startService(String)
- Start up a service.
-
stopCurrentServer()
- Stop the current server process.
-
stopServer(String)
- Stop a server process.
-
stopService(String, boolean)
- Stop a service.
ServerProcess
public ServerProcess()
main
public static void main(String argv[])
- Main function
run
public void run()
- Periodically check whether there are any service threads running.
Current period is every five seconds.
getServerProperties
public static Properties getServerProperties()
- Get the server's properties.
getServerNames
public static String[] getServerNames()
- Get the list of server names.
- Returns:
- the server names
getServer
public static ServerProcess getServer(String serverName)
- Get a server instance given its name.
- Parameters:
- serverName - server name
- Returns:
- ServerProcess instance
getServiceNames
public static String[] getServiceNames(String serverName)
- Get the list of service names for a server.
- Parameters:
- serverName - the server whose services are to be listed
- Returns:
- the service names for the server
getCurrentServerName
public static String getCurrentServerName()
- Get the name of the current server.
- Returns:
- the name of the server for this process
restartCurrentServer
public static void restartCurrentServer()
- Restart the current server process.
stopCurrentServer
public static void stopCurrentServer()
- Stop the current server process.
restartServer
public static void restartServer(String serverName)
- Restart a server process.
- Parameters:
- serverName - the name of the server to restart
startServer
public static void startServer(String serverName)
- Start a server process.
- Parameters:
- serverName - the name of the server to start
stopServer
public static void stopServer(String serverName)
- Stop a server process.
- Parameters:
- serverName - the name of the server to stop
startService
public static void startService(String serviceName) throws Exception
- Start up a service. Adds to autostart list, and restarts server.
- Parameters:
- serviceName - the name of the service to stop
- Throws: Exception
- If the service cannot be started
stopService
public static void stopService(String serviceName,
boolean realStop)
- Stop a service. Remove from autostart list.
- Parameters:
- serviceName - the name of the service to stop
restartService
public static void restartService(String serviceName,
int newPort) throws Exception
- Restart a single service in the current server.
- Parameters:
- serviceName - the short name of the service to restart
- Throws: Exception
- If the service cannot be restarted
isServiceRunning
public static boolean isServiceRunning(String serviceName)
- Check if a service is running in the current server.
- Parameters:
- serviceName - the service name
- Returns:
- true if service is running
getServiceConfiguration
public static ServiceConfiguration getServiceConfiguration(String serverName,
String serviceName)
- Get the configuration for a service in a server.
- Returns:
- the service configuration
getDefaultServiceConfiguration
public static ServiceConfiguration getDefaultServiceConfiguration(String serviceName)
- Get the default configuration for a service in a server.
- Returns:
- the default service configuration
getService
public static Service getService(String serviceName)
- Get a service instance.
- Parameters:
- serviceName - the name of the service to get
setUser
protected static native boolean setUser(String user)
- Sets the current user to the specified user name or user id.
- Parameters:
- user - the user name or id
- Returns:
- true if user was changed, false if permission denied
- Throws: IllegalArgumentException
- if the user name or id was invalid
setGroup
protected static native boolean setGroup(String group)
- Sets the current group to the specified group name or group id.
- Parameters:
- group - the group name or id
- Returns:
- true if group was changed, false if permission denied
- Throws: IllegalArgumentException
- if the group name or id was invalid
isRoot
protected static native boolean isRoot()
- Checks if the process is being run as (Posix) root. Allows for smarter
error reporting and security precautions.
- Returns:
- true is process is being run as root, false if not.
getDescription
public String getDescription()
- Get a server description.
- Parameters:
- serverName - the server name
- Returns:
- the server description
getServiceNames
public String[] getServiceNames()
- Get the service names for a server.
- Returns:
- the service names
getProperties
public ExProperties getProperties()
- Get the properties for a server.
- Returns:
- the server properties
getAutoStartServiceNames
public String[] getAutoStartServiceNames()
- Get the list of automatically-started service names for a server.
- Returns:
- the autostarted service names
getOrderedServiceNames
public String[] getOrderedServiceNames()
- Get the order in which to display service names for a server.
- Returns:
- the ordered list of service names
isRunning
public boolean isRunning()
- Find out if the server is running.
- Returns:
- true if the server has a running process
getThreadGroup
public static ThreadGroup getThreadGroup(String serviceName)
- Get the thread group for a service.
All Packages Class Hierarchy This Package Previous Next Index