@@ -75,30 +75,21 @@ public static AMapToData create(int unique, IntArrayList values) {
75
75
return _data ;
76
76
}
77
77
78
- public static AMapToData create (int size , int [] values , int nUnique , int k ) {
78
+ public static AMapToData create (int size , int [] values , int nUnique , int k ) throws Exception {
79
+ AMapToData _data = create (size , nUnique );
79
80
final ExecutorService pool = CommonThreadPool .get (k );
80
- try {
81
-
82
- AMapToData _data = create (size , nUnique );
83
- int blk = Math .max ((values .length / k ), 1024 );
84
- blk -= blk % 64 ; // ensure long size
85
- List <Future <?>> tasks = new ArrayList <>();
86
- for (int i = 0 ; i < values .length ; i += blk ) {
87
- int start = i ;
88
- int end = Math .min (i + blk , values .length );
89
- tasks .add (pool .submit (() -> _data .copyInt (values , start , end )));
90
- }
91
-
92
- for (Future <?> t : tasks )
93
- t .get ();
94
- return _data ;
95
- }
96
- catch (Exception e ){
97
- throw new RuntimeException ();
98
- }
99
- finally {
100
- pool .shutdown ();
81
+ int blk = Math .max ((values .length / k ), 1024 );
82
+ blk -= blk % 64 ; // ensure long size
83
+ List <Future <?>> tasks = new ArrayList <>();
84
+ for (int i = 0 ; i < values .length ; i += blk ) {
85
+ int start = i ;
86
+ int end = Math .min (i + blk , values .length );
87
+ tasks .add (pool .submit (() -> _data .copyInt (values , start , end )));
101
88
}
89
+
90
+ for (Future <?> t : tasks )
91
+ t .get ();
92
+ return _data ;
102
93
}
103
94
104
95
/**
0 commit comments