Skip to content

Commit

Permalink
add another example
Browse files Browse the repository at this point in the history
  • Loading branch information
vintagewang committed Jun 11, 2012
1 parent 148ecb8 commit 197a2e7
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bin/jwrapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<jvmtype>client</jvmtype>

<mainclass>com.github.vintage.wang.jwrapper.sample.HelloWorld</mainclass>
<mainclass>com.github.vintage.wang.jwrapper.sample.NiceServer</mainclass>

<properties>
<java.ext.dirs>${cpd}/../lib</java.ext.dirs>
Expand Down
2 changes: 1 addition & 1 deletion project/jwrapper.vcproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package com.github.vintage.wang.jwrapper.sample;

public class NiceServer {
private final Thread threadHello;

private final Thread threadNice;

public NiceServer() {
this.threadHello = new Thread(new Runnable() {

@Override
public void run() {
for (int i = 0; i < 10; i++) {
System.out.println(i + " Hello world");
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}, "Hello");

this.threadNice = new Thread(new Runnable() {

@Override
public void run() {
for (int i = 0; i < 10; i++) {
System.out.println(i + " Nice world");
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}, "Nice");
}

public void start() {
this.threadHello.start();
this.threadNice.start();
}

public static void main(String[] args) {
System.out.println("NiceServer begin...");
NiceServer niceServer = new NiceServer();
niceServer.start();
System.out.println("NiceServer end.");
}

}

0 comments on commit 197a2e7

Please sign in to comment.