We have a data service destination setup like this:
<destination id="Trades" adapter="java"> <properties> <factory>spring</factory> <source>lcdsTradeBlotterAssembler</source> <scope>application</scope> <item-class>com.domain.Trade</item-class> <use-transactions>false</use-transactions> <auto-sync-enabled>true</auto-sync-enabled> <cache-items>true</cache-items> <metadata> <identity property="uid" type="java.lang.String" /> </metadata> <network> <throttle-inbound policy="IGNORE" max-frequency="500" /> </network> </properties> </destination>
We implement a custom assembler by extending the AbstractAssembler.
The fill and refreshFill methods are implemented.
Updates are pushed to the client using a DataServiceTransaction:
DataServiceTransaction transaction = DataServiceTransaction.getCurrentDataServiceTransaction(); transaction.createItem(DESTINATION, trade); transaction.commit();
After we create items and push them from the server, the refresh method on the Assmbler gets called. We return 'APPEND_TO_FILL'.
The item shows up in the client side managed ArrayCollection. This ArrayCollection is bound to a datagrid.
The above works fine when we run the server and the client locally on the same machine. When the application is hosted on a another part of the network - we see that for some of the updates - a null gets added to the ArrayCollection, instead of the object pushed from the server. We found this by attaching a CollectionChange event listener to the managed ArrayCollection. This causes blank rows to show up in the Blotter. In some cases we have also seen duplicate rows.
We see that the object is delivered to the client but not applied to the ArrayCollection properly. I attached a screen shot of the client side stack where we loose the update.
Calling the refresh() method on the ArrayCollection after the update, fixes the situation. The nulls disappear and the ArrayCollection now has the right data !
Things tried so far:
Any pointers would be very helpful
We think this could be a bug. PLease reach out to customer support, and we should be able to provide you with a hotfix.
We traced this down to the fact that we have multiple threads reading off a JMS queue and pushing the add/update to the client via LCDS.
Each thread has its own instance of DataServiceTransaction - so this should be ok.
Following up with support.