Spingbatch default cursor reader reads data readily. It has below advantages over jdbctemplate:
1. Traditional jdbctemplate reader reads data in one time, which makes wait for a very long time. But cursor reader reads steadily, we don’t need to wait.
2. Jdbctemplate reads in one time, and put everything in memory. But cursor reader can avoid this problem by reading item one by one.
Daily Archives: August 3, 2015
Serialize, deserialize tree
Given a tree structure, serialize it, and deserialize it. One of the way to do it, is to store the number of children in the serializing. Take below tree as an example:
The serializing result will be:
The red ones are the number of children information. And use queue to implement it.
Check my code on github.