public class DefaultOwbFailOverService extends Object implements FailOverService
FailOverService
.Modifier and Type | Field and Description |
---|---|
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 |
NOT_HANDLED
Constructor and Description |
---|
DefaultOwbFailOverService() |
Modifier and Type | Method and Description |
---|---|
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)
Enable failover support.
|
void |
enablePassivationSupport(boolean supportPassivation)
Enable passivation support.
|
String |
getJvmId()
Used for tracking the origin of serialized bean instances.
|
ObjectInputStream |
getObjectInputStream(InputStream in)
Deprecated.
as we do not use Javassist anymore this is not needed anymore!
|
ObjectOutputStream |
getObjectOutputStream(OutputStream out)
Deprecated.
as we do not use Javassist anymore this is not needed anymore!
|
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)
Informs the service that the session did activate and that beans should be restored.
|
void |
sessionIsIdle(javax.servlet.http.HttpSession session)
Inform the service that a session is idle and that beans should be stored for fail over.
|
void |
sessionIsInUse(javax.servlet.http.HttpSession session)
Inform the service that the session will be active.
|
void |
sessionWillPassivate(javax.servlet.http.HttpSession session)
Invoked when the session will passivate and that beans should be stored for passivation.
|
protected void |
storeBeansInFailOverBag(FailOverBag bag,
javax.servlet.http.HttpSession session)
Stores the session and conversation contexts in the
FailOverBag . |
public static final String CONFIG_IS_SUPPORT_FAILOVER
public static final String CONFIG_IS_SUPPORT_PASSIVATE
public static final String CONFIG_RESOURCES_SERIALIZATION_HANDLER
public static final String ATTRIBUTE_SESSION_CONTEXT
public static final String ATTRIBUTE_CONVERSATION_CONTEXT_MAP
public void sessionIsIdle(javax.servlet.http.HttpSession session)
FailOverService
sessionIsIdle
in interface FailOverService
session
- The HttpSession
.public void sessionIsInUse(javax.servlet.http.HttpSession session)
FailOverService
sessionIsInUse
in interface FailOverService
session
- The HttpSession
.public void sessionDidActivate(javax.servlet.http.HttpSession session)
FailOverService
sessionDidActivate
in interface FailOverService
session
- The HttpSession
.public void sessionWillPassivate(javax.servlet.http.HttpSession session)
FailOverService
sessionWillPassivate
in interface FailOverService
session
- The HttpSession
.protected void addActivationListenerToSession(javax.servlet.http.HttpSession session)
FailOverSessionActivationListener
to the current HttpSession
.
It must not be manually registered when we store it as session attribute.session
- The current HttpSession
.protected void addFailOverBagToSession(FailOverBag bag, javax.servlet.http.HttpSession session)
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.bag
- The FailOverBag
.session
- The current HttpSession
.protected void storeBeansInFailOverBag(FailOverBag bag, javax.servlet.http.HttpSession session)
FailOverBag
.bag
- The FailOverBag
.session
- The current HttpSession
.protected void restoreBeansFromFailOverBag(FailOverBag bag, javax.servlet.http.HttpSession session)
FailOverBag
.bag
- The FailOverBag
.session
- The current HttpSession
.public Object handleResource(javax.enterprise.inject.spi.Bean<?> bean, Object resourceObject, ObjectInput in, ObjectOutput out)
handleResource
in interface FailOverService
bean
- The resource bean.resourceObject
- The resource bean instancein
- The input object streamout
- The output object streamFailOverService.NOT_HANDLED
if not handled by handler.public ObjectInputStream getObjectInputStream(InputStream in) throws IOException
getObjectInputStream
in interface FailOverService
IOException
public ObjectOutputStream getObjectOutputStream(OutputStream out) throws IOException
getObjectOutputStream
in interface FailOverService
IOException
public String getJvmId()
FailOverService
getJvmId
in interface FailOverService
public boolean isSupportFailOver()
isSupportFailOver
in interface FailOverService
public void enableFailOverSupport(boolean supportFailOver)
FailOverService
enableFailOverSupport
in interface FailOverService
supportFailOver
- true
to enable failover supportpublic boolean isSupportPassivation()
isSupportPassivation
in interface FailOverService
public void enablePassivationSupport(boolean supportPassivation)
FailOverService
enablePassivationSupport
in interface FailOverService
supportPassivation
- true
to enable passivation supportpublic boolean isPassivation()
Copyright © 2008–2016 The Apache Software Foundation. All rights reserved.