Page 3 of 3 FirstFirst 123
Results 21 to 23 of 23

Thread: DefaultSplitter and java.util.ConcurrentModificationException

  1. #21
    Join Date
    May 2011
    Location
    Cracow, Poland
    Posts
    53

    Default

    Ok. THANK YOU GUYS!!!

  2. #22
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,017

    Default

    Just to be clear; this code...

    Code:
    for (IData data : dataList) {
    is iterating over dataList(). The exception is caused because dataList is being modified after the interator is created. This might be another thread; it might be the current thread.

    When using this Java5 syntax, you are NOT allowed to modify the list (e.g. remove an element) within the loop. If you need to do that, you need to explicitly use an iterator, and use the iterator to remove the item...

    Code:
    Iterator<IData> iterator = dataList.iterator();
    while (iterator.hasNext) {
        IData iData = iterator.next();
    ...
        iterator.remove();
    }
    If you are not removing elements in the loop, then some other thread must be modifying the list.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  3. #23
    Join Date
    May 2011
    Location
    Cracow, Poland
    Posts
    53

    Default

    No, no...no removing from list
    To sum up, now I have such components as:
    - udp-inbound-channel-adapter
    - transformer
    - filter
    - resequencer
    - logging-channel-adapter

    Code:
    	<int-ip:udp-inbound-channel-adapter
    		id="udpInput" channel="inputChannel" multicast="true"
    		multicast-address="230.0.0.1" port="4446" receive-buffer-size="1400" />
    	<int:channel id="inputChannel" />
    
    	<int:chain id="headerChain" input-channel="inputChannel"
    		output-channel="headerTransformedChannel">
    		<int:transformer ref="headerTransformer" />
    		<int:header-enricher>
    			<int:header name="correlationId" expression="payload.header.serviceID"
    				overwrite="true" />
    			<int:header name="sequenceNumber" expression="payload.header.packetSeqNum"
    				overwrite="true" />
    		</int:header-enricher>
    	</int:chain>
    	<int:channel id="headerTransformedChannel">
    		<int:interceptors>
    			<int:wire-tap channel="packetControlChannel" />
    		</int:interceptors>
    	</int:channel>
    
    	<int:filter input-channel="headerTransformedChannel"
    		discard-channel="packetTypeErrorChannel" output-channel="packetFilteredChannel"
    		ref="packetTypeFilter" />
    	<int:channel id="packetFilteredChannel" />
    	
    	<int:resequencer id="seqNumberResequencer" comparator="messageComparator"
    		input-channel="packetFilteredChannel" output-channel="logger"
    		release-strategy="sequenceReleaseStrategy" />
    
    	<int:logging-channel-adapter id="logger" expression="payload.header.packetSeqNum" />
    And I am getting:
    Code:
    Exception in thread "UDP-Incoming-Msg-Handler" org.springframework.integration.MessageHandlingException: error occurred in message handler [org.springframework.integration.aggregator.CorrelatingMessageHandler#0]
    	at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:84)
    	at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:110)
    	at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:97)
    	at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:61)
    	at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:157)
    	at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:128)
    	at org.springframework.integration.core.MessagingTemplate.doSend(MessagingTemplate.java:288)
    	at org.springframework.integration.core.MessagingTemplate.send(MessagingTemplate.java:149)
    	at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.sendMessage(AbstractReplyProducingMessageHandler.java:176)
    	at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.sendReplyMessage(AbstractReplyProducingMessageHandler.java:160)
    	at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.produceReply(AbstractReplyProducingMessageHandler.java:125)
    	at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleResult(AbstractReplyProducingMessageHandler.java:119)
    	at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:101)
    	at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:78)
    	at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:110)
    	at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:97)
    	at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:61)
    	at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:157)
    	at org.springframework.integration.handler.MessageHandlerChain$ReplyForwardingMessageChannel.send(MessageHandlerChain.java:210)
    	at org.springframework.integration.handler.MessageHandlerChain$ReplyForwardingMessageChannel.send(MessageHandlerChain.java:203)
    	at org.springframework.integration.core.MessagingTemplate.doSend(MessagingTemplate.java:288)
    	at org.springframework.integration.core.MessagingTemplate.send(MessagingTemplate.java:149)
    	at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.sendMessage(AbstractReplyProducingMessageHandler.java:176)
    	at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.sendReplyMessage(AbstractReplyProducingMessageHandler.java:160)
    	at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.produceReply(AbstractReplyProducingMessageHandler.java:125)
    	at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleResult(AbstractReplyProducingMessageHandler.java:119)
    	at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:101)
    	at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:78)
    	at org.springframework.integration.handler.MessageHandlerChain$1.send(MessageHandlerChain.java:154)
    	at org.springframework.integration.core.MessagingTemplate.doSend(MessagingTemplate.java:288)
    	at org.springframework.integration.core.MessagingTemplate.send(MessagingTemplate.java:149)
    	at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.sendMessage(AbstractReplyProducingMessageHandler.java:176)
    	at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.sendReplyMessage(AbstractReplyProducingMessageHandler.java:160)
    	at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.produceReply(AbstractReplyProducingMessageHandler.java:125)
    	at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleResult(AbstractReplyProducingMessageHandler.java:119)
    	at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:101)
    	at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:78)
    	at org.springframework.integration.handler.MessageHandlerChain.handleMessageInternal(MessageHandlerChain.java:137)
    	at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:78)
    	at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:110)
    	at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:97)
    	at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:61)
    	at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:157)
    	at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:128)
    	at org.springframework.integration.core.MessagingTemplate.doSend(MessagingTemplate.java:288)
    	at org.springframework.integration.core.MessagingTemplate.send(MessagingTemplate.java:149)
    	at org.springframework.integration.endpoint.MessageProducerSupport.sendMessage(MessageProducerSupport.java:92)
    	at org.springframework.integration.ip.udp.UnicastReceivingChannelAdapter.access$300(UnicastReceivingChannelAdapter.java:43)
    	at org.springframework.integration.ip.udp.UnicastReceivingChannelAdapter$1.run(UnicastReceivingChannelAdapter.java:151)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    	at java.lang.Thread.run(Thread.java:662)
    Caused by: java.lang.NullPointerException
    	at org.springframework.integration.aggregator.CorrelatingMessageHandler.handleMessageInternal(CorrelatingMessageHandler.java:169)
    	at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:78)
    	... 51 more

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •