Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
黄志磊
committed
Jan 13, 2016
1 parent
bfb8c56
commit b91eb9b
Showing
2 changed files
with
44 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 30 additions & 1 deletion
31
mpush-tools/src/test/java/com/shinemo/mpush/tools/spi/SpiTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,13 +1,42 @@ | |||
package com.shinemo.mpush.tools.spi; | package com.shinemo.mpush.tools.spi; | ||
|
|
||
|
|
||
import java.util.concurrent.Executor; | |||
import java.util.concurrent.Executors; | |||
|
|||
import org.junit.Ignore; | |||
import org.junit.Test; | |||
|
|||
import com.shinemo.mpush.tools.spi.test.TestService; | import com.shinemo.mpush.tools.spi.test.TestService; | ||
|
|
||
|
|||
public class SpiTest { | public class SpiTest { | ||
|
|
||
public static void main(String[] args) { | private static Executor pool = Executors.newCachedThreadPool(); | ||
|
|||
@Ignore | |||
@Test | |||
public void baseTest(){ | |||
TestService testService = ServiceContainer.getInstance(TestService.class); | TestService testService = ServiceContainer.getInstance(TestService.class); | ||
System.out.println(testService.sayHi(" huang")); | System.out.println(testService.sayHi(" huang")); | ||
} | } | ||
|
|||
@Test | |||
public void mulThreadTest() throws InterruptedException{ | |||
pool.execute(new Worker()); | |||
pool.execute(new Worker()); | |||
Thread.sleep(Integer.MAX_VALUE); | |||
} | |||
|
|||
|
|
||
private static final class Worker implements Runnable{ | |||
|
|||
@Override | |||
public void run() { | |||
TestService testService = ServiceContainer.getInstance(TestService.class); | |||
System.out.println(testService.sayHi(" huang")); | |||
} | |||
|
|||
} | |||
|
|||
} | } |