Author: asoldano
Date: 2014-10-17 09:35:36 -0400 (Fri, 17 Oct 2014)
New Revision: 19010
Modified:
container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/dmr/HandlerAdd.java
container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/service/HandlerChainService.java
container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/service/HandlerService.java
Log:
[JBWS-3838] Sort UnifiedHandlerMetaData instances before adding to the chain
Modified:
container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/dmr/HandlerAdd.java
===================================================================
---
container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/dmr/HandlerAdd.java 2014-10-17
13:11:58 UTC (rev 19009)
+++
container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/dmr/HandlerAdd.java 2014-10-17
13:35:36 UTC (rev 19010)
@@ -29,6 +29,7 @@
import static org.jboss.as.webservices.dmr.PackageUtils.getHandlerServiceName;
import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
import org.jboss.as.controller.AbstractAddStepHandler;
import org.jboss.as.controller.OperationContext;
@@ -51,6 +52,7 @@
final class HandlerAdd extends AbstractAddStepHandler {
static final HandlerAdd INSTANCE = new HandlerAdd();
+ static final AtomicInteger counter = new AtomicInteger(0);
private HandlerAdd() {
// forbidden instantiation
@@ -77,7 +79,7 @@
final String handlerName = address.getElement(address.size() -
1).getValue();
final String handlerClass = operation.require(CLASS).asString();
- final HandlerService service = new HandlerService(handlerName,
handlerClass);
+ final HandlerService service = new HandlerService(handlerName, handlerClass,
counter.incrementAndGet());
final ServiceTarget target = context.getServiceTarget();
final ServiceName configServiceName = getConfigServiceName(configType,
configName);
final ServiceRegistry registry = context.getServiceRegistry(false);
Modified:
container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/service/HandlerChainService.java
===================================================================
---
container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/service/HandlerChainService.java 2014-10-17
13:11:58 UTC (rev 19009)
+++
container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/service/HandlerChainService.java 2014-10-17
13:35:36 UTC (rev 19010)
@@ -24,6 +24,8 @@
import static org.jboss.as.webservices.WSMessages.MESSAGES;
import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.List;
import org.jboss.as.webservices.dmr.ListInjector;
@@ -63,6 +65,15 @@
@Override
public void start(final StartContext context) throws StartException {
+ Comparator<UnifiedHandlerMetaData> c = new
Comparator<UnifiedHandlerMetaData>() {
+ @Override
+ public int compare(UnifiedHandlerMetaData o1, UnifiedHandlerMetaData o2) {
+ return o1.getId().compareTo(o2.getId());
+ }
+ };
+ synchronized (handlers) {
+ Collections.sort(handlers, c);
+ }
handlerChain = new UnifiedHandlerChainMetaData(null, null, protocolBindings,
handlers, false, handlerChainId);
}
Modified:
container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/service/HandlerService.java
===================================================================
---
container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/service/HandlerService.java 2014-10-17
13:11:58 UTC (rev 19009)
+++
container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/service/HandlerService.java 2014-10-17
13:35:36 UTC (rev 19010)
@@ -36,11 +36,13 @@
private final String handlerName;
private final String handlerClass;
+ private final int counter;
private volatile UnifiedHandlerMetaData handler;
- public HandlerService(String handlerName, String handlerClass) {
+ public HandlerService(String handlerName, String handlerClass, int counter) {
this.handlerName = handlerName;
this.handlerClass = handlerClass;
+ this.counter = counter;
}
@Override
@@ -50,7 +52,7 @@
@Override
public void start(final StartContext context) throws StartException {
- handler = new UnifiedHandlerMetaData(handlerClass, handlerName, null, null, null,
null);
+ handler = new UnifiedHandlerMetaData(handlerClass, handlerName, null, null, null,
null, String.valueOf(counter));
}
@Override
Show replies by date