org.jboss.cache.interceptors
Class MarshalledValueInterceptor

java.lang.Object
  extended by org.jboss.cache.interceptors.Interceptor
      extended by org.jboss.cache.interceptors.MarshalledValueInterceptor
All Implemented Interfaces:
InterceptorMBean

public class MarshalledValueInterceptor
extends Interceptor

Interceptor that handles the wrapping and unwrapping of cached data using MarshalledValues. Known "excluded" types are not wrapped/unwrapped, which at this time include String, Java primitives and their Object wrappers, as well as arrays of excluded types.

The MarshalledValue wrapper handles lazy deserialization from byte array representations.

Since:
2.1.0
Author:
Manik Surtani (manik@jboss.org)
See Also:
MarshalledValue

Field Summary
 
Fields inherited from class org.jboss.cache.interceptors.Interceptor
cache, configuration, last, log, next, trace
 
Constructor Summary
MarshalledValueInterceptor()
           
 
Method Summary
protected  MarshalledValue createAndAddMarshalledValue(Object toWrap, Set<MarshalledValue> marshalledValues, InvocationContext ctx)
           
 Object invoke(InvocationContext context)
          Using this method call for forwarding a call in the chain is not redable and error prone in the case of interceptors extending other interceptors.
protected  boolean isInternalCollection(int argSubscript, int methodId)
          prepare methods include Maps and Lists in args.
protected  boolean needToReplaceMap(int argSubscript, int methodId)
          put(Map) contents should not be wrapped since the map will need to be iterated over.
protected  Map wrapMap(Map<Object,Object> m, Set<MarshalledValue> marshalledValues, InvocationContext ctx)
           
 
Methods inherited from class org.jboss.cache.interceptors.Interceptor
assertTransactionValid, dumpStatistics, getLast, getNext, getStatisticsEnabled, initLogger, isActive, isPreparing, isValid, nextInterceptor, peekNode, resetStatistics, setCache, setLast, setNext, setStatisticsEnabled, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MarshalledValueInterceptor

public MarshalledValueInterceptor()
Method Detail

invoke

public Object invoke(InvocationContext context)
              throws Throwable
Description copied from class: Interceptor
Using this method call for forwarding a call in the chain is not redable and error prone in the case of interceptors extending other interceptors. This metod rather refers to interceptor doing its business operations rather than delegating to the nextInterceptor interceptor in chain. For delegation please use Interceptor.nextInterceptor(org.jboss.cache.InvocationContext)

Overrides:
invoke in class Interceptor
Throws:
Throwable

isInternalCollection

protected boolean isInternalCollection(int argSubscript,
                                       int methodId)
prepare methods include Maps and Lists in args. These should not be mistaken for needing wrapping as MarshalledValues.


needToReplaceMap

protected boolean needToReplaceMap(int argSubscript,
                                   int methodId)
put(Map) contents should not be wrapped since the map will need to be iterated over. The contents of the Map, however, should be wrapped.


wrapMap

protected Map wrapMap(Map<Object,Object> m,
                      Set<MarshalledValue> marshalledValues,
                      InvocationContext ctx)
               throws NotSerializableException
Throws:
NotSerializableException

createAndAddMarshalledValue

protected MarshalledValue createAndAddMarshalledValue(Object toWrap,
                                                      Set<MarshalledValue> marshalledValues,
                                                      InvocationContext ctx)
                                               throws NotSerializableException
Throws:
NotSerializableException


Copyright © 2008 JBoss, a division of Red Hat. All Rights Reserved.