cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "csupi (JIRA)" <>
Subject [jira] [Created] (CXF-4559) Part of SoapMessage content interchange between two concurrent webservice calls
Date Fri, 12 Oct 2012 13:37:08 GMT
csupi created CXF-4559:

             Summary: Part of SoapMessage content interchange between two concurrent webservice
                 Key: CXF-4559
             Project: CXF
          Issue Type: Bug
          Components: JAX-WS Runtime
    Affects Versions: 2.5.6, 2.5.5, 2.5.4
         Environment: Ubuntu 12.04
            Reporter: csupi
            Priority: Critical

I have a simple cxf webservice call with a DTO parameter. There is a HashMap and some other
fields in the DTO.

I realized that there are some cases where the content in the map is changed somewhere on
the server side.

I created a simple unit test. I put a String into the map and into a field where the map is.
Create a webservice with jetty and create 15 clients to call my webservice 1000 times.
After the test execution I realized that about in the 2% of the calls, the String in the map
differs from the value in the field.

Here is my unit test:

package com.statlogics.credilogic.integrator.esb.impl.cxf;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.UUID;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicInteger;

import javax.jws.WebParam;
import javax.jws.WebService;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;

import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
import org.junit.Test;

public class WebserviceEndpointIt {

    private static final int number_of_clients = 15;

    private final AtomicInteger badCounter = new AtomicInteger(0);
    private final AtomicInteger successCounter = new AtomicInteger(0);

    public static class Event implements Serializable {
        private static final long serialVersionUID = 1L;

        private final HashMap<String, Object> map = new HashMap<String, Object>();

        private String expected;
        private String i;
        private String thread;

    public interface MockWebservice {
        void doit(@WebParam(name = "message") Event message);

    public class MockWebserviceImpl implements MockWebservice {
        public void doit(final Event message) {
             * read the two strings from the FIELD and the MAP
            final String expected = message.expected;
            final Object idFromMap = == null ? null :"expected");

            if (expected == null || idFromMap == null || !expected.equals(idFromMap)) {
            } else {

    public void testMyWebService() throws InterruptedException, ExecutionException {
        final MockWebservice endpoint = new MockWebserviceImpl();
        final JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
        svrFactory.getInInterceptors().add(new LoggingInInterceptor());

        final Collection<Callable<Object>> clients = new ArrayList<Callable<Object>>();
        for (int i = 0; i < number_of_clients; i++) {
            final int thread = i;
            clients.add(new Callable<Object>() {
                public Object call() throws Exception {
                    final MockWebservice client = createClient();
                    for (int i = 0; i < 1000; i++) {
                        final Event message = new Event();
                        final String id = Integer.valueOf(thread).toString() + "-" + Integer.valueOf(i).toString()
+ " "
                                + UUID.randomUUID().toString();

                         * put the same string into the MAP and the FIELD
              "expected", id);
                        message.expected = id;

              "thread", Integer.valueOf(thread));
              "i", Integer.valueOf(i));
                        message.thread = Integer.valueOf(thread).toString();
                        message.i = Integer.valueOf(i).toString();
                    return null;

        for (final Future<Object> item : Executors.newFixedThreadPool(number_of_clients).invokeAll(clients))

        System.out.println("bad: " + this.badCounter.get() + "  success: " + this.successCounter.get());

    private MockWebservice createClient() {
        final JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
        final MockWebservice client = (MockWebservice) factory.create();
        return client;


This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message