Hi,
i'm using CXF 2.2.11 and a monothreaded http client which loops to send
request sequentially and i have found a particular behavior, the order of
incoming messages is not always kept.

It seems happening when the AutomaticWorkQueue is full.

I have looked to the code and i have found in the OneWayProcessorInterceptor
:

public void handleMessage(Message message) throws Fault {
        ...
                *try {

message.getExchange().get(Bus.class).getExtension(WorkQueueManager.class)
                    .getAutomaticWorkQueue().execute(new Runnable() {
                        public void run() {
                            chain.resume();
                        }
                    });
                } catch (RejectedExecutionException e) {
                    //the executor queue is full, so run the task in the
caller thread
                    chain.resume();
                }*
          ...
    }

But in the case where you are running the task in the caller thread it is
handling the newest message not the oldest so the order is not preserved.

in the called method, i print the thread and the message number (to easily
see the behavior i had a sleep of one second.

thread : Thread[default-workqueue-1,5,default-workqueue]
MESSAGE 1 PROCESSED
thread : thread[5169...@qtp-5024475-0,5,main]
MESSAGE 12 PROCESSED
thread : Thread[default-workqueue-1,5,default-workqueue]
MESSAGE 2 PROCESSED
thread : thread[5169...@qtp-5024475-0,5,main]
MESSAGE 14 PROCESSED
thread : Thread[default-workqueue-1,5,default-workqueue]
MESSAGE 3 PROCESSED
thread : thread[5169...@qtp-5024475-0,5,main]
MESSAGE 16 PROCESSED
thread : Thread[default-workqueue-1,5,default-workqueue]
MESSAGE 4 PROCESSED
thread : thread[5169...@qtp-5024475-0,5,main]
MESSAGE 18 PROCESSED
thread : Thread[default-workqueue-1,5,default-workqueue]   <= The 19th
message has been sent and i stop sending
MESSAGE 5 PROCESSED
thread : Thread[default-workqueue-1,5,default-workqueue]
MESSAGE 6 PROCESSED
thread : Thread[default-workqueue-1,5,default-workqueue]
MESSAGE 7 PROCESSED
thread : Thread[default-workqueue-1,5,default-workqueue]
MESSAGE 8 PROCESSED
thread : Thread[default-workqueue-1,5,default-workqueue]
MESSAGE 9 PROCESSED
thread : Thread[default-workqueue-1,5,default-workqueue]
MESSAGE 10 PROCESSED
thread : Thread[default-workqueue-1,5,default-workqueue]
MESSAGE 11 PROCESSED
thread : Thread[default-workqueue-1,5,default-workqueue]
MESSAGE 13 PROCESSED
thread : Thread[default-workqueue-1,5,default-workqueue]
MESSAGE 15 PROCESSED
thread : Thread[default-workqueue-1,5,default-workqueue]
MESSAGE 17 PROCESSED
thread : Thread[default-workqueue-1,5,default-workqueue]
MESSAGE 19 PROCESSED


I would know why the implementation does not keep the message order ?

Thanks for answers.

Reply via email to