How to configure multi-threading in TestNG having @DataProvider, @Factory and one @Test method
<p>I want to have multi-threading in my class, i.e., my <code>@Test</code> method should run in parallel.</p>

<p>The test class has one <code>@Test</code> annotated method, one <code>@DataProvider</code> and one <code>@Factory</code> method which is a constructor of my test-class.</p>

<p>I have also overridden <code>getTestName(ITest class)</code> method. My test-data has 28 scenarios.</p>

<p><strong>EDIT</strong></p>

<pre><code>@Listeners com.loyalty.HTMLReporter.class
public class TestClass implemented ITest {

@DataProvider 
public static Object[][] dp () {
//I read test data from a file. The test-data could vary from 2 to 1000         
//scenarios.
Object tests [][] = new Object [testcaseIdMap.keyset().toArray().length][];

    for (Object ket : testcaseIdMap.keySet().toArray()){
        tests[i] = new Object[1];
        tests[i][0] = key.toString();
        i++;
    }
return tests 
}

@Factory (dataProvider = "dp")
public TestClass (String testcaseId) {
this.testcaseId = testcaseId;
}

@Test
public void TC () {
//some code
}

@Override
public String getTestName () {
return testcaseId;
}

@BeforeSuite
public void createDBConnection () {
// some code
}

@AfterSuite
public void failedTestCases () {
//some code
}
</code></pre>