Author: richard.opalka(a)jboss.com
Date: 2008-11-28 09:32:23 -0500 (Fri, 28 Nov 2008)
New Revision: 8818
Modified:
common/trunk/src/main/java/org/jboss/wsf/common/servlet/AbstractEndpointServlet.java
Log:
[JBWS-2268] refactoring javax.annotation support to stack specific endpoint servlet
Modified:
common/trunk/src/main/java/org/jboss/wsf/common/servlet/AbstractEndpointServlet.java
===================================================================
---
common/trunk/src/main/java/org/jboss/wsf/common/servlet/AbstractEndpointServlet.java 2008-11-28
13:58:54 UTC (rev 8817)
+++
common/trunk/src/main/java/org/jboss/wsf/common/servlet/AbstractEndpointServlet.java 2008-11-28
14:32:23 UTC (rev 8818)
@@ -22,8 +22,6 @@
package org.jboss.wsf.common.servlet;
import java.io.IOException;
-import java.util.LinkedList;
-import java.util.List;
import javax.management.ObjectName;
import javax.servlet.ServletConfig;
@@ -32,10 +30,7 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.jboss.logging.Logger;
import org.jboss.wsf.common.ObjectNameFactory;
-import org.jboss.wsf.common.javax.JavaxAnnotationHelper;
-import org.jboss.wsf.common.javax.PreDestroyHolder;
import org.jboss.wsf.spi.SPIProvider;
import org.jboss.wsf.spi.SPIProviderResolver;
import org.jboss.wsf.spi.deployment.Deployment;
@@ -57,13 +52,9 @@
public abstract class AbstractEndpointServlet extends HttpServlet
{
- // provide logging
- private static final Logger log = Logger.getLogger(AbstractEndpointServlet.class);
-
private final SPIProvider spiProvider =
SPIProviderResolver.getInstance().getProvider();
protected Endpoint endpoint;
private EndpointRegistry epRegistry;
- private List<PreDestroyHolder> preDestroyRegistry = new
LinkedList<PreDestroyHolder>();
/**
* Constructor
@@ -81,28 +72,6 @@
this.initServiceEndpoint(servletConfig);
}
- @Override
- public void destroy()
- {
- synchronized(this.preDestroyRegistry)
- {
- for (PreDestroyHolder holder : this.preDestroyRegistry)
- {
- try
- {
- JavaxAnnotationHelper.callPreDestroyMethod(holder.getObject());
- }
- catch (Exception exception)
- {
- log.error(exception.getMessage(), exception);
- }
- }
- this.preDestroyRegistry.clear();
- this.preDestroyRegistry = null;
- }
- super.destroy();
- }
-
/**
* Serves the requests
*/
@@ -114,30 +83,22 @@
EndpointAssociation.setEndpoint(endpoint);
RequestHandler requestHandler = endpoint.getRequestHandler();
requestHandler.handleHttpRequest(endpoint, req, res, getServletContext());
- registerForPreDestroy(endpoint);
}
finally
{
+ this.postService();
EndpointAssociation.removeEndpoint();
}
}
- private void registerForPreDestroy(Endpoint ep)
+ /**
+ * Template method
+ */
+ protected void postService()
{
- PreDestroyHolder holder =
(PreDestroyHolder)ep.getAttachment(PreDestroyHolder.class);
- if (holder != null)
- {
- synchronized(this.preDestroyRegistry)
- {
- if (!this.preDestroyRegistry.contains(holder))
- {
- this.preDestroyRegistry.add(holder);
- }
- }
- ep.removeAttachment(PreDestroyHolder.class);
- }
+ // does nothing (because of BC)
}
-
+
/**
* Template method
* @param cfg servlet config
Show replies by date