Skip to content

Commit

Permalink
Move destroy() to concrete bean classes
Browse files Browse the repository at this point in the history
git-svn-id: http://anonsvn.jboss.org/repos/weld/ri/trunk@529 1c488680-804c-0410-94cd-c6b725194a0e
  • Loading branch information
pmuir committed Dec 15, 2008
1 parent 7286f19 commit fc56f4d
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 16 deletions.
Expand Up @@ -326,19 +326,6 @@ else if (deploymentType.equals(Standard.class) && !STANDARD_WEB_BEAN_CLASSES.con
}
}

/**
* Destroys a bean instance
*
* @param instance The instance to destroy
*
* @see javax.webbeans.manager.Bean#destroy(Object)
*/
@Override
public void destroy(T instance)
{
// TODO Auto-generated method stub
}

/**
* Binds the decorators to the proxy
*/
Expand Down Expand Up @@ -579,4 +566,5 @@ public String toDetailedString()
buffer.append(mergedStereotypes.toString() + "\n");
return buffer.toString();
}

}
Expand Up @@ -38,6 +38,8 @@
import org.jboss.webbeans.introspector.AnnotatedField;
import org.jboss.webbeans.introspector.AnnotatedMethod;
import org.jboss.webbeans.introspector.AnnotatedParameter;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
import org.jboss.webbeans.util.Names;

/**
Expand All @@ -49,6 +51,8 @@
*/
public class EnterpriseBean<T> extends AbstractClassBean<T>
{

private LogProvider log = Logging.getLogProvider(EnterpriseBean.class);

private EjbMetaData<T> ejbMetaData;

Expand Down Expand Up @@ -225,14 +229,21 @@ public T create()
}

/**
* Destroys an instance of a bean
* Destroys an instance of the bean
*
* @param instance The instance
*/
@Override
public void destroy(T instance)
{
super.destroy(instance);
try
{
getRemoveMethod().invoke(instance);
}
catch (Exception e)
{
log.error("Error destroying " + toString(), e);
}
}

/**
Expand Down
Expand Up @@ -58,6 +58,12 @@ public Event<T> create()
return new EventImpl<T>(getTypeParameter(), manager, getBindingTypesArray());
}

@Override
public void destroy(Event<T> instance)
{
// TODO Implement any EventBean destruction needed
}

/**
* Returns a string representation
*
Expand Down
Expand Up @@ -56,5 +56,11 @@ public Instance<T> create()
{
return new InstanceImpl<T>(getTypeParameter(), manager, getBindingTypesArray());
}

@Override
public void destroy(Instance<T> instance)
{
// TODO Implement any cleanup needed
}

}
Expand Up @@ -74,6 +74,12 @@ public T create()
checkReturnValue(instance);
return instance;
}

@Override
public void destroy(T instance)
{
// TODO Implement any cleanup needed
}

/**
* Gets the annotated item representing the field
Expand Down
Expand Up @@ -82,6 +82,12 @@ public T create()
checkReturnValue(instance);
return instance;
}

@Override
public void destroy(T instance)
{
// TODO Implement any cleanup needed
}

/**
* Initializes the bean and its metadata
Expand Down
Expand Up @@ -95,7 +95,14 @@ public T create()
@Override
public void destroy(T instance)
{
callPreDestroy(instance);
try
{
callPreDestroy(instance);
}
catch (Exception e)
{
log.error("Error destroying " + toString(), e);
}
}

/**
Expand Down

0 comments on commit fc56f4d

Please sign in to comment.