@@ -1260,6 +1260,7 @@ public static void testTileMatrixBoundingBox(GeoPackage geoPackage)
12601260 }
12611261
12621262 static boolean threadedTileDaoError = false ;
1263+ static boolean threadedTileDaoStop = false ;
12631264
12641265 /**
12651266 * Test threaded tile dao
@@ -1272,8 +1273,8 @@ public static void testTileMatrixBoundingBox(GeoPackage geoPackage)
12721273 public static void testThreadedTileDao (final GeoPackage geoPackage )
12731274 throws SQLException {
12741275
1275- final int threads = 100 ;
1276- final int attemptsPerThread = 100 ;
1276+ final int threads = 30 ;
1277+ final int attemptsPerThread = 50 ;
12771278
12781279 TileMatrixSetDao tileMatrixSetDao = geoPackage .getTileMatrixSetDao ();
12791280
@@ -1283,6 +1284,7 @@ public static void testThreadedTileDao(final GeoPackage geoPackage)
12831284 for (TileMatrixSet tileMatrixSet : results ) {
12841285
12851286 threadedTileDaoError = false ;
1287+ threadedTileDaoStop = false ;
12861288
12871289 final String tableName = tileMatrixSet .getTableName ();
12881290
@@ -1293,6 +1295,11 @@ public void run() {
12931295 for (int i = 0 ; i < attemptsPerThread ; i ++) {
12941296
12951297 try {
1298+
1299+ if (threadedTileDaoStop ) {
1300+ break ;
1301+ }
1302+
12961303 ContentsDao contentsDao = geoPackage
12971304 .getContentsDao ();
12981305 Contents contents = contentsDao
@@ -1303,12 +1310,17 @@ public void run() {
13031310 + tableName );
13041311 }
13051312
1313+ if (threadedTileDaoStop ) {
1314+ break ;
1315+ }
1316+
13061317 TileDao dao = geoPackage .getTileDao (tableName );
13071318 if (dao == null ) {
13081319 throw new Exception (
13091320 "Tile DAO was null, table name: "
13101321 + tableName );
13111322 }
1323+
13121324 } catch (Exception e ) {
13131325 threadedTileDaoError = true ;
13141326 e .printStackTrace ();
@@ -1327,6 +1339,15 @@ public void run() {
13271339 executor .shutdown ();
13281340 try {
13291341 executor .awaitTermination (60 , TimeUnit .SECONDS );
1342+ threadedTileDaoStop = true ;
1343+ } catch (InterruptedException e ) {
1344+ e .printStackTrace ();
1345+ TestCase .fail ("Waiting for threads terminated: "
1346+ + e .getMessage ());
1347+ }
1348+
1349+ try {
1350+ executor .awaitTermination (10 , TimeUnit .SECONDS );
13301351 } catch (InterruptedException e ) {
13311352 e .printStackTrace ();
13321353 TestCase .fail ("Waiting for threads terminated: "
0 commit comments