org.apache.webbeans.spi
Interface FailOverService


public interface FailOverService

Container provided failover and passivation service.


Field Summary
static Object NOT_HANDLED
          Returned, if container or application does not handle the resource object in the handleResource() method.
 
Method Summary
 void enableFailOverSupport(boolean flag)
          Enable failover support.
 void enablePassivationSupport(boolean flag)
          Enable passivation support.
 String getFailOverAttributeName()
           
 String getJVMId()
          Used for tracking the origin of serialized bean instances.
 ObjectInputStream getObjectInputStream(InputStream in)
          Container provided object input stream.
 ObjectOutputStream getObjectOutputStream(OutputStream out)
          Container provided object output stream.
 Object handleResource(javax.enterprise.inject.spi.Bean<?> bean, Object resourceObject, ObjectInput in, ObjectOutput out)
          Container provided custom handler for serialize / deserialize a resource bean.
 boolean isSupportFailOver()
           
 boolean isSupportPassivation()
           
 void restoreBeans(javax.servlet.http.HttpSession session)
          Invoked when we try to restore cdi bean instances.
 void sessionIsIdle(javax.servlet.http.HttpSession session)
          Inform the service that a session is idle.
 void sessionIsInUse(javax.servlet.http.HttpSession session)
          Inform the service that a session will be active.
 void sessionWillPassivate(javax.servlet.http.HttpSession session)
          Container is going to actively passivate a session.
 

Field Detail

NOT_HANDLED

static final Object NOT_HANDLED
Returned, if container or application does not handle the resource object in the handleResource() method.

Method Detail

getJVMId

String getJVMId()
Used for tracking the origin of serialized bean instances.

Returns:
an UUID which is unique for each installation. This might change on restarts.

getFailOverAttributeName

String getFailOverAttributeName()
Returns:
The session attribute name used to store the bean instances bag

isSupportFailOver

boolean isSupportFailOver()
Returns:
Whether or not the system supports failover

isSupportPassivation

boolean isSupportPassivation()
Returns:
Whether or not the system support passivation

enableFailOverSupport

void enableFailOverSupport(boolean flag)
Enable failover support.

Parameters:
flag - true to enable failover support

enablePassivationSupport

void enablePassivationSupport(boolean flag)
Enable passivation support.

Parameters:
flag - true to enable passivation support

sessionIsIdle

void sessionIsIdle(javax.servlet.http.HttpSession session)
Inform the service that a session is idle. Invoked when we finish a request.

Parameters:
session -

sessionIsInUse

void sessionIsInUse(javax.servlet.http.HttpSession session)
Inform the service that a session will be active. Invoked when a request is received.

Parameters:
session -

restoreBeans

void restoreBeans(javax.servlet.http.HttpSession session)
Invoked when we try to restore cdi bean instances. Invoked when a request is finished.

Parameters:
session -

sessionWillPassivate

void sessionWillPassivate(javax.servlet.http.HttpSession session)
Container is going to actively passivate a session.

Parameters:
session -

getObjectInputStream

ObjectInputStream getObjectInputStream(InputStream in)
                                       throws IOException
Container provided object input stream. Note, the stream should support deserializing javassist objects.

Returns:
custom object input stream.
Throws:
IOException

getObjectOutputStream

ObjectOutputStream getObjectOutputStream(OutputStream out)
                                         throws IOException
Container provided object output stream. Note, the stream should support serializing javassist objects.

Returns:
custom object output stream.
Throws:
IOException

handleResource

Object handleResource(javax.enterprise.inject.spi.Bean<?> bean,
                      Object resourceObject,
                      ObjectInput in,
                      ObjectOutput out)
Container provided custom handler for serialize / deserialize a resource bean. Add clean up code in this method will allow OWB to override default resource bean passivation behavior. Note, in the method, a container may first invoke the application provided handler(@See SerializationHandler) if it is configured.

Parameters:
bean - The resource bean.
resourceObject - The resource bean instance
in - The input object stream
out - The output object stream
Returns:
NOT_HANDLED if not handled by handler.


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