int random;
synchronized (rnd) {
random = rnd.nextInt();
}
final String typeName = pointType.getTypeName();
SimpleFeatureStore featureSource;
int insertCount = 0;
try {
for (int i = 0; i < numInserts; i++) {
builder.reset();
builder.set("sp", String.valueOf(random));
builder.set("ip", Integer.valueOf(random));
SimpleFeature feature = builder.buildFeature(String.valueOf(random));
featureSource = (SimpleFeatureStore) dataStore.getFeatureSource(typeName);
Transaction tx = new DefaultTransaction();
featureSource.setTransaction(tx);
try {
featureSource.addFeatures(DataUtilities.collection(feature));
tx.commit();
insertCount++;
} finally {
tx.close();
}