1 |
| |
2 |
| |
3 |
| |
4 |
| |
5 |
| |
6 |
| |
7 |
| |
8 |
| package org.jboss.cache.pojo.interceptors; |
9 |
| |
10 |
| import org.jboss.aop.joinpoint.Invocation; |
11 |
| import org.jboss.aop.joinpoint.MethodInvocation; |
12 |
| import org.jboss.cache.Fqn; |
13 |
| import org.jboss.cache.pojo.util.AopUtil; |
14 |
| |
15 |
| |
16 |
| |
17 |
| |
18 |
| |
19 |
| |
20 |
| public class CheckNonSerializableInterceptor extends AbstractInterceptor |
21 |
| { |
22 |
| private boolean marshallNonSerializable_ = false; |
23 |
| |
24 |
7640
| public Object invoke(Invocation in) throws Throwable
|
25 |
| { |
26 |
7640
| if (!(in instanceof MethodInvocation))
|
27 |
| { |
28 |
0
| throw new IllegalArgumentException("CheckIdInterceptor.invoke(): invocation not MethodInvocation");
|
29 |
| } |
30 |
| |
31 |
7640
| MethodInvocation invocation = (MethodInvocation) in;
|
32 |
7640
| Fqn id = (Fqn) invocation.getArguments()[0];
|
33 |
7640
| Object obj = invocation.getArguments()[1];
|
34 |
7640
| if (!marshallNonSerializable_)
|
35 |
| { |
36 |
7640
| AopUtil.checkObjectType(obj);
|
37 |
| } |
38 |
| else |
39 |
| { |
40 |
0
| log.debug("invoke(): marshallNonSerializable is set to true. We will skip object type checking for id:"
|
41 |
| + id.toString()); |
42 |
| } |
43 |
| |
44 |
7640
| try
|
45 |
| { |
46 |
7640
| return invocation.invokeNext();
|
47 |
| } |
48 |
| finally |
49 |
| { |
50 |
| } |
51 |
| } |
52 |
| |
53 |
429
| public void setMarshallNonSerializable(boolean isTrue)
|
54 |
| { |
55 |
429
| marshallNonSerializable_ = isTrue;
|
56 |
| } |
57 |
| } |