Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite9a82bf

Browse files
author
zhourenjian
committed
1. Now SimpleRPCRunnable class is not implementing interface of Runnable.
2. Only wrap SimpleRPCRunnable#ajaxRun in Thread instead of Display#asyncRun3. Update author name in comments.
1 parent19a2208 commite9a82bf

File tree

12 files changed

+52
-31
lines changed

12 files changed

+52
-31
lines changed

‎sources/net.sf.j2s.ajax/ajaxcore/net/sf/j2s/ajax/AClass.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* A callback object is provided for action to be executed after the class is
2121
* loaded.
2222
*
23-
* @authorjosson smith
23+
* @authorzhou renjian
2424
*
2525
* 2006-8-4
2626
*/

‎sources/net.sf.j2s.ajax/ajaxcore/net/sf/j2s/ajax/ARunnable.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* give convenience for <code>AClass</code> or <code>ASWTClass</code>
1919
* to set and to get the class that is loaded.
2020
*
21-
* @authorjosson smith
21+
* @authorzhou renjian
2222
*
2323
* 2006-8-4
2424
*/

‎sources/net.sf.j2s.ajax/ajaxcore/net/sf/j2s/ajax/HttpRequest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
* This class can be considered as a bridge of Java's AJAX programming and
3939
* JavaScript/Browser's AJAX programming.
4040
*
41-
* @authorjosson smith
41+
* @authorzhou renjian
4242
*
4343
* 2006-2-11
4444
*/

‎sources/net.sf.j2s.ajax/ajaxcore/net/sf/j2s/ajax/IXHRCallback.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
* 4 Loaded<br>
3131
* The data transfer has been completed.<br>
3232
*
33-
* @authorjosson smith
33+
* @authorzhou renjian
3434
*
3535
* 2006-2-11
3636
*/

‎sources/net.sf.j2s.ajax/ajaxcore/net/sf/j2s/ajax/XHRCallbackAdapter.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
/**
1717
* This adapter provides a default implementation of IXHRCallback.
1818
*
19-
* @authorjosson smith
19+
* @authorzhou renjian
2020
*
2121
* 2006-2-11
2222
*/

‎sources/net.sf.j2s.ajax/ajaxrpc/net/sf/j2s/ajax/SimpleRPCRequest.java‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
importjava.net.URLEncoder;
1818

1919
/**
20-
* @authorjosson smith
20+
* @authorzhou renjian
2121
*
2222
* 2006-10-10
2323
*/
@@ -47,10 +47,21 @@ public static void switchToLocalJavaThreadMode() {
4747
* runnable.ajaxIn ();
4848
* net.sf.j2s.ajax.SimpleRPCRequest.ajaxRequest (runnable);
4949
*/
50-
publicstaticvoidrequest(SimpleRPCRunnablerunnable) {
50+
publicstaticvoidrequest(finalSimpleRPCRunnablerunnable) {
5151
runnable.ajaxIn();
5252
if (runningMode ==MODE_LOCAL_JAVA_THREAD) {
53-
newThread(runnable).start();
53+
newThread(newRunnable() {
54+
publicvoidrun() {
55+
try {
56+
runnable.ajaxRun();
57+
}catch (RuntimeExceptione) {
58+
e.printStackTrace();// should never fail in Java thread mode!
59+
runnable.ajaxFail();
60+
return;
61+
}
62+
runnable.ajaxOut();
63+
}
64+
}).start();
5465
}else {
5566
ajaxRequest(runnable);
5667
}

‎sources/net.sf.j2s.ajax/ajaxrpc/net/sf/j2s/ajax/SimpleRPCRunnable.java‎

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*
2020
* 2006-10-10
2121
*/
22-
publicabstractclassSimpleRPCRunnableextendsSimpleSerializableimplementsRunnable{
22+
publicabstractclassSimpleRPCRunnableextendsSimpleSerializable {
2323

2424
publicStringgetHttpURL() {
2525
return"simplerpc";// url is relative to the servlet!
@@ -51,19 +51,4 @@ public String getHttpMethod() {
5151
*/
5252
publicvoidajaxFail() {};
5353

54-
/**
55-
* @j2sNative
56-
* net.sf.j2s.ajax.ServletThread.call(this);
57-
*/
58-
publicvoidrun() {
59-
// ajaxIn(); // ajaxIn should be run outside of #run directly
60-
try {
61-
ajaxRun();
62-
}catch (RuntimeExceptione) {
63-
e.printStackTrace();// should never fail in Java thread mode!
64-
ajaxFail();
65-
return;
66-
}
67-
ajaxOut();
68-
}
6954
}

‎sources/net.sf.j2s.ajax/ajaxrpc/net/sf/j2s/ajax/SimpleRPCSWTRequest.java‎

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
importorg.eclipse.swt.widgets.Display;
1919

2020
/**
21-
* @authorjosson smith
21+
* @authorzhou renjian
2222
*
2323
* 2006-10-10
2424
*/
@@ -29,10 +29,35 @@ public class SimpleRPCSWTRequest extends SimpleRPCRequest {
2929
* runnable.ajaxIn ();
3030
* net.sf.j2s.ajax.SimpleRPCRequest.ajaxRequest (runnable);
3131
*/
32-
publicstaticvoidswtRequest(SimpleRPCRunnablerunnable) {
32+
publicstaticvoidswtRequest(finalSimpleRPCRunnablerunnable) {
3333
runnable.ajaxIn();
3434
if (runningMode ==MODE_LOCAL_JAVA_THREAD) {
35-
Display.getDefault().asyncExec(runnable);
35+
newThread(newRunnable(){
36+
publicvoidrun() {
37+
try {
38+
runnable.ajaxRun();
39+
}catch (RuntimeExceptione) {
40+
e.printStackTrace();// should never fail in Java thread mode!
41+
Displaydisp =Display.getDefault();
42+
if (disp !=null) {
43+
disp.syncExec(newRunnable() {
44+
publicvoidrun() {
45+
runnable.ajaxFail();
46+
}
47+
});
48+
}
49+
return;
50+
}
51+
Displaydisp =Display.getDefault();
52+
if (disp !=null) {
53+
disp.syncExec(newRunnable() {
54+
publicvoidrun() {
55+
runnable.ajaxOut();
56+
}
57+
});
58+
}
59+
}
60+
}).start();
3661
}else {
3762
swtAJAXRequest(runnable);
3863
}

‎sources/net.sf.j2s.ajax/ajaxrpc/net/sf/j2s/ajax/SimpleSerializable.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
importjava.util.Set;
2323

2424
/**
25-
* @authorjosson smith
25+
* @authorzhou renjian
2626
*
2727
* 2006-10-11
2828
*/

‎sources/net.sf.j2s.ajax/ajaxswt/net/sf/j2s/ajax/ASWTClass.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public void run() {
3333
* parameter as <code>AClass#load</code>. Or call <code>ASWTClass#shellLoad</code>
3434
* or <code>ASWTClass#displayLoad</code> with extra Shell/Display argument.
3535
*
36-
* @authorjosson smith
36+
* @authorzhou renjian
3737
*
3838
* 2006-8-4
3939
*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp