You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Jukka Zitting (JIRA)" <ji...@apache.org> on 2009/04/27 17:02:32 UTC

[jira] Moved: (OCM-5) No Filter on method finalize for Proxy

     [ https://issues.apache.org/jira/browse/OCM-5?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jukka Zitting moved JCR-2046 to OCM-5:
--------------------------------------

    Component/s:     (was: jackrabbit-ocm)
       Workflow: no-reopen-closed, patch-avail  (was: jira)
            Key: OCM-5  (was: JCR-2046)
        Project: Jackrabbit OCM  (was: Jackrabbit Content Repository)

> No Filter on method finalize for Proxy
> --------------------------------------
>
>                 Key: OCM-5
>                 URL: https://issues.apache.org/jira/browse/OCM-5
>             Project: Jackrabbit OCM
>          Issue Type: Bug
>            Reporter: Sandrine Raffalli
>
> The InvocationHandler of a proxy is called when the method finalize() is called, that means the proxy loads the object when the GC tries to delete it.
> Adding a CallbackFilter to the Enhancer could be a solution to avoid that :
> public class ProxyManagerImpl implements ProxyManager {
> 	private static final CallbackFilter FINALIZE_FILTER = new CallbackFilter() {
> 		public int accept(Method method) {
> 			if (method.getParameterTypes().length == 0 && method.getName().equals("finalize")) {
> 				return 1;
> 			} else {
> 				return 0;
> 			}
> 		}
> 	};
>        ...
> 	public Object createBeanProxy(BeanConverter beanConverter, String path, Session session, Node parentNode, BeanDescriptor beanDescriptor,
> 			ClassDescriptor beanClassDescriptor, Class beanClass, Object parent) {
> 		...
> 		return Enhancer.create(beanClass, getInterfaces(beanClass), FINALIZE_FILTER, new Callback[] { loader , NoOp.INSTANCE});
> 	}
>         ...
> 	public Object createCollectionProxy(Session session, CollectionConverter collectionConverter, Node parentNode,
> 			CollectionDescriptor collectionDescriptor, Class collectionFieldClass) {
>                ....
> 		return Enhancer.create(collectionFieldClass, getInterfaces(collectionFieldClass), FINALIZE_FILTER, new Callback[] { loader , NoOp.INSTANCE});
> 	}
> 	...
> }
> Maybe you may consider other methods such as "equals", "hashCode"...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.