org.granite.gravity
Class DefaultGravity
java.lang.Object
org.granite.gravity.DefaultGravity
- All Implemented Interfaces:
- ShutdownListener, DefaultGravityMBean, Gravity
- Direct Known Subclasses:
- GAEGravity
public class DefaultGravity
- extends Object
- implements Gravity, DefaultGravityMBean
- Author:
- William DRAI, Franck WOLFF
|
Method Summary |
boolean |
access(String channelId)
|
boolean |
cancel(AsyncChannelRunner runner)
|
protected
|
createChannel(ChannelFactory<C> channelFactory,
String clientId)
|
void |
execute(AsyncChannelRunner runner)
|
|
getChannel(ChannelFactory<C> channelFactory,
String clientId)
|
long |
getChannelIdleTimeoutMillis()
|
int |
getCorePoolSize()
|
GraniteConfig |
getGraniteConfig()
|
GravityConfig |
getGravityConfig()
|
String |
getGravityFactoryName()
|
long |
getKeepAliveTimeMillis()
|
long |
getLongPollingTimeoutMillis()
|
int |
getMaximumPoolSize()
|
int |
getMaxMessagesQueuedPerChannel()
|
int |
getQueueCapacity()
|
int |
getQueueRemainingCapacity()
|
int |
getQueueSize()
|
long |
getReconnectIntervalMillis()
|
int |
getReconnectMaxAttempts()
|
ServiceAdapter |
getServiceAdapter(String messageType,
String destinationId)
|
ServicesConfig |
getServicesConfig()
|
SharedContext |
getSharedContext()
|
UdpReceiverFactory |
getUdpReceiverFactory()
|
Message |
handleMessage(ChannelFactory<?> channelFactory,
Message message)
|
Message |
handleMessage(ChannelFactory<?> channelFactory,
Message message,
boolean skipInterceptor)
|
boolean |
hasUdpReceiverFactory()
|
GraniteContext |
initThread(String sessionId,
String clientType)
|
protected void |
internalStart()
|
boolean |
isRetryOnError()
|
boolean |
isStarted()
|
protected void |
postManage(Channel channel)
|
Message |
publishMessage(AsyncMessage message)
|
Message |
publishMessage(Channel fromChannel,
AsyncMessage message)
|
void |
reconfigure(GravityConfig gravityConfig,
GraniteConfig graniteConfig)
|
void |
releaseThread()
|
Channel |
removeChannel(String channelId,
boolean timeout)
|
void |
restart()
|
void |
setChannelIdleTimeoutMillis(long channelIdleTimeoutMillis)
|
void |
setCorePoolSize(int corePoolSize)
|
void |
setKeepAliveTimeMillis(long keepAliveTimeMillis)
|
void |
setLongPollingTimeoutMillis(long longPollingTimeoutMillis)
|
void |
setMaximumPoolSize(int maximumPoolSize)
|
void |
setMaxMessagesQueuedPerChannel(int maxMessagesQueuedPerChannel)
|
void |
setRetryOnError(boolean retryOnError)
|
void |
start()
|
void |
stop()
|
void |
stop(boolean now)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DefaultGravity
public DefaultGravity(GravityConfig gravityConfig,
ServicesConfig servicesConfig,
GraniteConfig graniteConfig,
SharedContext sharedContext)
getGravityConfig
public GravityConfig getGravityConfig()
- Specified by:
getGravityConfig in interface Gravity
getServicesConfig
public ServicesConfig getServicesConfig()
- Specified by:
getServicesConfig in interface Gravity
getGraniteConfig
public GraniteConfig getGraniteConfig()
- Specified by:
getGraniteConfig in interface Gravity
getSharedContext
public SharedContext getSharedContext()
- Specified by:
getSharedContext in interface Gravity
isStarted
public boolean isStarted()
- Specified by:
isStarted in interface DefaultGravityMBean- Specified by:
isStarted in interface Gravity
getServiceAdapter
public ServiceAdapter getServiceAdapter(String messageType,
String destinationId)
- Specified by:
getServiceAdapter in interface Gravity
start
public void start()
throws Exception
- Specified by:
start in interface DefaultGravityMBean- Specified by:
start in interface Gravity
- Throws:
Exception
internalStart
protected void internalStart()
restart
public void restart()
throws Exception
- Specified by:
restart in interface DefaultGravityMBean
- Throws:
Exception
reconfigure
public void reconfigure(GravityConfig gravityConfig,
GraniteConfig graniteConfig)
- Specified by:
reconfigure in interface Gravity
stop
public void stop()
throws Exception
- Specified by:
stop in interface ShutdownListener- Specified by:
stop in interface DefaultGravityMBean- Specified by:
stop in interface Gravity
- Throws:
Exception
stop
public void stop(boolean now)
throws Exception
- Specified by:
stop in interface Gravity
- Throws:
Exception
getGravityFactoryName
public String getGravityFactoryName()
- Specified by:
getGravityFactoryName in interface DefaultGravityMBean
getChannelIdleTimeoutMillis
public long getChannelIdleTimeoutMillis()
- Specified by:
getChannelIdleTimeoutMillis in interface DefaultGravityMBean
setChannelIdleTimeoutMillis
public void setChannelIdleTimeoutMillis(long channelIdleTimeoutMillis)
- Specified by:
setChannelIdleTimeoutMillis in interface DefaultGravityMBean
isRetryOnError
public boolean isRetryOnError()
- Specified by:
isRetryOnError in interface DefaultGravityMBean
setRetryOnError
public void setRetryOnError(boolean retryOnError)
- Specified by:
setRetryOnError in interface DefaultGravityMBean
getLongPollingTimeoutMillis
public long getLongPollingTimeoutMillis()
- Specified by:
getLongPollingTimeoutMillis in interface DefaultGravityMBean
setLongPollingTimeoutMillis
public void setLongPollingTimeoutMillis(long longPollingTimeoutMillis)
- Specified by:
setLongPollingTimeoutMillis in interface DefaultGravityMBean
getMaxMessagesQueuedPerChannel
public int getMaxMessagesQueuedPerChannel()
- Specified by:
getMaxMessagesQueuedPerChannel in interface DefaultGravityMBean
setMaxMessagesQueuedPerChannel
public void setMaxMessagesQueuedPerChannel(int maxMessagesQueuedPerChannel)
- Specified by:
setMaxMessagesQueuedPerChannel in interface DefaultGravityMBean
getReconnectIntervalMillis
public long getReconnectIntervalMillis()
- Specified by:
getReconnectIntervalMillis in interface DefaultGravityMBean
getReconnectMaxAttempts
public int getReconnectMaxAttempts()
- Specified by:
getReconnectMaxAttempts in interface DefaultGravityMBean
getCorePoolSize
public int getCorePoolSize()
- Specified by:
getCorePoolSize in interface DefaultGravityMBean
setCorePoolSize
public void setCorePoolSize(int corePoolSize)
- Specified by:
setCorePoolSize in interface DefaultGravityMBean
getKeepAliveTimeMillis
public long getKeepAliveTimeMillis()
- Specified by:
getKeepAliveTimeMillis in interface DefaultGravityMBean
setKeepAliveTimeMillis
public void setKeepAliveTimeMillis(long keepAliveTimeMillis)
- Specified by:
setKeepAliveTimeMillis in interface DefaultGravityMBean
getMaximumPoolSize
public int getMaximumPoolSize()
- Specified by:
getMaximumPoolSize in interface DefaultGravityMBean
setMaximumPoolSize
public void setMaximumPoolSize(int maximumPoolSize)
- Specified by:
setMaximumPoolSize in interface DefaultGravityMBean
getQueueCapacity
public int getQueueCapacity()
- Specified by:
getQueueCapacity in interface DefaultGravityMBean
getQueueRemainingCapacity
public int getQueueRemainingCapacity()
- Specified by:
getQueueRemainingCapacity in interface DefaultGravityMBean
getQueueSize
public int getQueueSize()
- Specified by:
getQueueSize in interface DefaultGravityMBean
hasUdpReceiverFactory
public boolean hasUdpReceiverFactory()
- Specified by:
hasUdpReceiverFactory in interface Gravity
getUdpReceiverFactory
public UdpReceiverFactory getUdpReceiverFactory()
- Specified by:
getUdpReceiverFactory in interface Gravity
createChannel
protected <C extends Channel> C createChannel(ChannelFactory<C> channelFactory,
String clientId)
getChannel
public <C extends Channel> C getChannel(ChannelFactory<C> channelFactory,
String clientId)
- Specified by:
getChannel in interface Gravity
removeChannel
public Channel removeChannel(String channelId,
boolean timeout)
- Specified by:
removeChannel in interface Gravity
access
public boolean access(String channelId)
- Specified by:
access in interface Gravity
execute
public void execute(AsyncChannelRunner runner)
- Specified by:
execute in interface Gravity
cancel
public boolean cancel(AsyncChannelRunner runner)
- Specified by:
cancel in interface Gravity
handleMessage
public Message handleMessage(ChannelFactory<?> channelFactory,
Message message)
- Specified by:
handleMessage in interface Gravity
handleMessage
public Message handleMessage(ChannelFactory<?> channelFactory,
Message message,
boolean skipInterceptor)
- Specified by:
handleMessage in interface Gravity
initThread
public GraniteContext initThread(String sessionId,
String clientType)
- Specified by:
initThread in interface Gravity
releaseThread
public void releaseThread()
- Specified by:
releaseThread in interface Gravity
publishMessage
public Message publishMessage(AsyncMessage message)
- Specified by:
publishMessage in interface Gravity
publishMessage
public Message publishMessage(Channel fromChannel,
AsyncMessage message)
- Specified by:
publishMessage in interface Gravity
postManage
protected void postManage(Channel channel)