Revision a4e5bf72
Added by Andreas Müller almost 6 years ago
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/common/ResultSetPartitioner.java | ||
---|---|---|
121 | 121 |
* @param partitionedIO |
122 | 122 |
*/ |
123 | 123 |
public void doPartition(IPartitionedIO<STATE> partitionedIO, STATE state) { |
124 |
int i = 0; |
|
125 |
try{ |
|
124 |
try{ |
|
126 | 125 |
profiler.startTx(); |
127 | 126 |
TransactionStatus txStatus = getTransaction(partitionSize, partitionedIO); |
128 | 127 |
|
129 |
i = 1; |
|
130 | 128 |
state.makeTransactionalSourceReference(partitionedIO.getReferenceService()); |
131 | 129 |
|
132 | 130 |
profiler.startRs(); |
133 | 131 |
ResultSet rs = makePartitionResultSet(); |
134 |
i = 2; |
|
132 |
|
|
135 | 133 |
profiler.startRelObjects(); |
136 | 134 |
this.relatedObjects = partitionedIO.getRelatedObjectsForPartition(rs, state); |
137 |
i = 3; |
|
138 |
state.setRelatedObjects(relatedObjects); |
|
139 |
i = 4; |
|
135 |
state.setRelatedObjects(relatedObjects); |
|
136 |
|
|
140 | 137 |
profiler.startRs2(); |
141 | 138 |
partitionResultSet = makePartitionResultSet(); |
142 |
i = 5; |
|
139 |
|
|
143 | 140 |
profiler.startDoPartition(); |
144 | 141 |
partitionedIO.doPartition(this, state); |
145 |
i = 6; |
|
142 |
|
|
146 | 143 |
profiler.startDoCommit(); |
147 | 144 |
partitionedIO.commitTransaction(txStatus); |
148 | 145 |
state.resetTransactionalSourceReference(); |
149 |
i = 7; |
|
146 |
|
|
150 | 147 |
profiler.end(); |
151 | 148 |
state.setRelatedObjects(null); |
152 |
i = 8; |
|
149 |
|
|
153 | 150 |
logger.info("Saved " + getCurrentNumberOfRows() + " " + partitionedIO.getPluralString() ); |
154 | 151 |
profiler.print(); |
155 | 152 |
}catch(Exception e){ |
156 |
String message = "Exception (%s) occurred at position " + i + " while handling import partition for %s."; |
|
157 |
message = String.format(message, e.getMessage(), partitionedIO.getPluralString()); |
|
158 |
e.printStackTrace(); |
|
153 |
String message = "Exception (%s) occurred while handling import partition for %s."; |
|
154 |
message = String.format(message, e.getLocalizedMessage(), partitionedIO.getPluralString()); |
|
159 | 155 |
throw new RuntimeException(message, e); |
160 | 156 |
} |
161 | 157 |
} |
Also available in: Unified diff
remove unwanted commits