org.granite.gravity
Class GravityManager
java.lang.Object
org.granite.gravity.GravityManager
public class GravityManager
- extends Object
- Author:
- Franck WOLFF
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
GravityManager
public GravityManager()
start
public static Gravity start(ServletConfig servletConfig,
ChannelFactory channelFactory)
throws ServletException
- Parse gravity configuration (granite-config.xml), start gravity by using the specified factory and put it
in ServletContext. If Gravity is already started, returns the previous instance from the servlet context.
This method is intended to be used in GenericServlet.init(ServletConfig) methods only and
synchronizes on the current ServletContext instance.
- Parameters:
servletConfig - the servlet config passed in HttpServlet.init(ServletConfig config) method.channelFactory - an implementation specific ChannelFactory instance.
- Returns:
- a newly created and started Gravity instance or previously started one.
- Throws:
ServletException - if something goes wrong (GravityFactory not found, Gravity.start() error, etc.)
reconfigure
public static void reconfigure(ServletContext context,
GravityConfig gravityConfig)
- Reconfigure gravity with the new supplied configuration (after reloading granite-config.xml).
Only these configuration options are taken into account when reconfiguring Gravity:
- channelIdleTimeoutMillis
- longPollingTimeout
- retryOnError
- maxMessagesQueuedPerChannel
- corePoolSize
- maximumPoolSize
- keepAliveTimeMillis
- Parameters:
context - the ServletContext where the gravity instance is registered.gravityConfig - the new (reloaded) GravityConfig.
getGravity
public static Gravity getGravity(ServletContext context)
- Returns a previously started Gravity instance. This method isn't synchronized and should be used in
HttpServlet.doPost(...) methods only.
- Parameters:
context - the ServletContext from which to retrieve the Gravity instance.
- Returns:
- the unique and started Gravity instance (or null if
start(ServletConfig, ChannelFactory)
has never been called).