org.apache.webbeans.web.failover
Class DefaultOwbFailOverService

java.lang.Object
  extended by org.apache.webbeans.web.failover.DefaultOwbFailOverService
All Implemented Interfaces:
FailOverService

public class DefaultOwbFailOverService
extends Object
implements FailOverService

Default implementation of the FailOverService.


Field Summary
static String ATTRIBUTE_CONVERSATION_CONTEXT_MAP
           
static String ATTRIBUTE_SESSION_CONTEXT
           
static String CONFIG_IS_SUPPORT_FAILOVER
           
static String CONFIG_IS_SUPPORT_PASSIVATE
           
static String CONFIG_RESOURCES_SERIALIZATION_HANDLER
           
 
Fields inherited from interface org.apache.webbeans.spi.FailOverService
NOT_HANDLED
 
Constructor Summary
DefaultOwbFailOverService()
           
 
Method Summary
protected  void addActivationListenerToSession(javax.servlet.http.HttpSession session)
          Adds the FailOverSessionActivationListener to the current HttpSession.
protected  void addFailOverBagToSession(FailOverBag bag, javax.servlet.http.HttpSession session)
          Store the FailOverBag as attribute to the current HttpSession.
 void enableFailOverSupport(boolean supportFailOver)
           
 void enablePassivationSupport(boolean supportPassivation)
           
 String getJvmId()
           
 ObjectInputStream getObjectInputStream(InputStream in)
          Get object input stream.
 ObjectOutputStream getObjectOutputStream(OutputStream out)
          Get object output stream.
 Object handleResource(javax.enterprise.inject.spi.Bean<?> bean, Object resourceObject, ObjectInput in, ObjectOutput out)
          Except the EJB remote stub, it is hard to handle other types of resources.
 boolean isPassivation()
           
 boolean isSupportFailOver()
           
 boolean isSupportPassivation()
           
protected  void restoreBeansFromFailOverBag(FailOverBag bag, javax.servlet.http.HttpSession session)
          Restores the session and conversation contexts from the given FailOverBag.
 void sessionDidActivate(javax.servlet.http.HttpSession session)
           
 void sessionIsIdle(javax.servlet.http.HttpSession session)
           
 void sessionIsInUse(javax.servlet.http.HttpSession session)
           
 void sessionWillPassivate(javax.servlet.http.HttpSession session)
           
protected  void storeBeansInFailOverBag(FailOverBag bag, javax.servlet.http.HttpSession session)
          Stores the session and conversation contexts in the FailOverBag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONFIG_IS_SUPPORT_FAILOVER

public static final String CONFIG_IS_SUPPORT_FAILOVER
See Also:
Constant Field Values

CONFIG_IS_SUPPORT_PASSIVATE

public static final String CONFIG_IS_SUPPORT_PASSIVATE
See Also:
Constant Field Values

CONFIG_RESOURCES_SERIALIZATION_HANDLER

public static final String CONFIG_RESOURCES_SERIALIZATION_HANDLER
See Also:
Constant Field Values

ATTRIBUTE_SESSION_CONTEXT

public static final String ATTRIBUTE_SESSION_CONTEXT
See Also:
Constant Field Values

ATTRIBUTE_CONVERSATION_CONTEXT_MAP

public static final String ATTRIBUTE_CONVERSATION_CONTEXT_MAP
See Also:
Constant Field Values
Constructor Detail

DefaultOwbFailOverService

public DefaultOwbFailOverService()
Method Detail

sessionIsIdle

public void sessionIsIdle(javax.servlet.http.HttpSession session)
Specified by:
sessionIsIdle in interface FailOverService

sessionIsInUse

public void sessionIsInUse(javax.servlet.http.HttpSession session)
Specified by:
sessionIsInUse in interface FailOverService

sessionDidActivate

public void sessionDidActivate(javax.servlet.http.HttpSession session)
Specified by:
sessionDidActivate in interface FailOverService

sessionWillPassivate

public void sessionWillPassivate(javax.servlet.http.HttpSession session)
Specified by:
sessionWillPassivate in interface FailOverService

addActivationListenerToSession

protected void addActivationListenerToSession(javax.servlet.http.HttpSession session)
Adds the FailOverSessionActivationListener to the current HttpSession. It must not be manually registered when we store it as session attribute.

Parameters:
session - The current HttpSession.

addFailOverBagToSession

protected void addFailOverBagToSession(FailOverBag bag,
                                       javax.servlet.http.HttpSession session)
Store the FailOverBag as attribute to the current HttpSession. So when the session is fail over to other JVM or local disk, the attribute could also be serialized.

Parameters:
bag - The FailOverBag.
session - The current HttpSession.

storeBeansInFailOverBag

protected void storeBeansInFailOverBag(FailOverBag bag,
                                       javax.servlet.http.HttpSession session)
Stores the session and conversation contexts in the FailOverBag.

Parameters:
bag - The FailOverBag.
session - The current HttpSession.

restoreBeansFromFailOverBag

protected void restoreBeansFromFailOverBag(FailOverBag bag,
                                           javax.servlet.http.HttpSession session)
Restores the session and conversation contexts from the given FailOverBag.

Parameters:
bag - The FailOverBag.
session - The current HttpSession.

handleResource

public Object handleResource(javax.enterprise.inject.spi.Bean<?> bean,
                             Object resourceObject,
                             ObjectInput in,
                             ObjectOutput out)
Except the EJB remote stub, it is hard to handle other types of resources. Here we delegate serialization/deserialization to the application provided SerializationHandler.

Specified by:
handleResource in interface FailOverService

getObjectInputStream

public ObjectInputStream getObjectInputStream(InputStream in)
                                       throws IOException
Get object input stream. Note, the stream should support deserialize javassist objects.

Specified by:
getObjectInputStream in interface FailOverService
Returns:
custom object input stream.
Throws:
IOException

getObjectOutputStream

public ObjectOutputStream getObjectOutputStream(OutputStream out)
                                         throws IOException
Get object output stream. Note, the stream should support deserialize javassist objects.

Specified by:
getObjectOutputStream in interface FailOverService
Returns:
custom object output stream.
Throws:
IOException

getJvmId

public String getJvmId()
Specified by:
getJvmId in interface FailOverService

isSupportFailOver

public boolean isSupportFailOver()
Specified by:
isSupportFailOver in interface FailOverService

enableFailOverSupport

public void enableFailOverSupport(boolean supportFailOver)
Specified by:
enableFailOverSupport in interface FailOverService

isSupportPassivation

public boolean isSupportPassivation()
Specified by:
isSupportPassivation in interface FailOverService

enablePassivationSupport

public void enablePassivationSupport(boolean supportPassivation)
Specified by:
enablePassivationSupport in interface FailOverService

isPassivation

public boolean isPassivation()


Copyright © 2008-2012 The Apache Software Foundation. All Rights Reserved.