risdenk commented on code in PR #829:
URL: https://github.com/apache/solr/pull/829#discussion_r862868550
##########
solr/core/src/test/org/apache/solr/schema/TestBulkSchemaConcurrent.java:
##########
@@ -51,39 +60,50 @@ protected String getCloudSolrConfig() {
return "solrconfig-managed-schema.xml";
}
+ @Before
+ public void setup() {
+ super.beforeTest();
+ setupRestTestHarnesses();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ closeRestTestHarnesses();
+ super.tearDown();
+ }
+
@Test
- @SuppressWarnings({"unchecked"})
public void test() throws Exception {
+ final List<List<String>> collectErrors = Collections.synchronizedList(new
ArrayList<>());
- final int threadCount = 5;
- setupRestTestHarnesses();
- Thread[] threads = new Thread[threadCount];
- @SuppressWarnings({"rawtypes"})
- final List<List> collectErrors = Collections.synchronizedList(new
ArrayList<>());
+ final ExecutorService executorService =
+ ExecutorUtil.newMDCAwareFixedThreadPool(
+ THREAD_COUNT, new
SolrNamedThreadFactory(this.getClass().getSimpleName()));
- for (int i = 0; i < threadCount; i++) {
+ List<Callable<Void>> callees = new ArrayList<>(THREAD_COUNT);
+ for (int i = 0; i < THREAD_COUNT; i++) {
final int finalI = i;
- threads[i] =
- new Thread() {
- @Override
- public void run() {
- @SuppressWarnings({"rawtypes"})
- ArrayList errs = new ArrayList();
- collectErrors.add(errs);
- try {
- invokeBulkAddCall(finalI, errs);
- invokeBulkReplaceCall(finalI, errs);
- invokeBulkDeleteCall(finalI, errs);
- } catch (Exception e) {
- e.printStackTrace();
- }
+ Callable<Void> call =
+ () -> {
+ List<String> errs = new ArrayList<>();
+ collectErrors.add(errs);
+ try {
+ invokeBulkAddCall(finalI, errs);
+ invokeBulkReplaceCall(finalI, errs);
+ invokeBulkDeleteCall(finalI, errs);
+ } catch (Exception e) {
+ e.printStackTrace();
+ Thread.currentThread().interrupt();
Review Comment:
Yea this is leftover from trying to figure out why things were hanging. I'll
fix it to just interruptedexception.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]