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

Commitb4c78bd

Browse files
author
zhourenjian
committed
Refactoring codes and fixing bug
1 parent5545a49 commitb4c78bd

File tree

9 files changed

+172
-127
lines changed

9 files changed

+172
-127
lines changed

‎sources/net.sf.j2s.ajax/ajaxpipe/net/sf/j2s/ajax/CompoundPipeRequest.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,9 @@ static CompoundPipeRunnable unregisterPipe(String id) {
152152
synchronized (allPipes) {
153153
for (inti =0;i <allPipes.length;i++) {
154154
if (allPipes[i] !=null &&allPipes[i].id.equals(id)) {
155+
CompoundPipeRunnablepipe =allPipes[i];
155156
allPipes[i] =null;
156-
returnallPipes[i];
157+
returnpipe;
157158
}
158159
}
159160
returnnull;

‎sources/net.sf.j2s.ajax/ajaxpipe/net/sf/j2s/ajax/CompoundPipeRunnable.java‎

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public boolean pipeDestroy() {
5858
pipes[i].pipeDestroy();
5959
}
6060
}
61-
pipeKey =null;
61+
//pipeKey = null;
6262
status =0;// starting
6363
returnsuper.pipeDestroy();
6464
}
@@ -136,6 +136,9 @@ public boolean weave(CompoundPipeSession pipe) {
136136
synchronized (pipes) {
137137
for (inti =0;i <pipes.length;i++) {
138138
if (pipe ==pipes[i]) {
139+
pipe.pipeKey =this.pipeKey;
140+
pipe.parent =this;
141+
initPipeSession(pipe);
139142
returnfalse;
140143
}
141144
}
@@ -147,6 +150,8 @@ public boolean weave(CompoundPipeSession pipe) {
147150
}
148151
pipes[i] =pipe;// replace it!!!
149152
lastSetup =System.currentTimeMillis();
153+
pipe.pipeKey =this.pipeKey;
154+
pipe.parent =this;
150155
returntrue;
151156
}
152157
}
@@ -165,7 +170,13 @@ public boolean weave(CompoundPipeSession pipe) {
165170
lastSetup =System.currentTimeMillis();
166171
}
167172
}
173+
pipe.pipeKey =this.pipeKey;
168174
pipe.parent =this;
175+
initPipeSession(pipe);
176+
returntrue;
177+
}
178+
179+
privatevoidinitPipeSession(CompoundPipeSessionpipe) {
169180
while (pipe.session ==null) {
170181
Stringkey =nextSessionKey();
171182
booleanisKeyOK =true;
@@ -180,18 +191,20 @@ public boolean weave(CompoundPipeSession pipe) {
180191
break;
181192
}
182193
}
183-
returntrue;
184194
}
185195

186196
publicbooleanunweave(CompoundPipeSessionpipe) {
197+
/*
187198
if (pipeKey == null || !pipeKey.equals(pipe.pipeKey)) {
188199
return false;
189200
}
201+
//*/
190202
for (inti =0;i <pipes.length;i++) {
191203
if (pipe ==pipes[i] || (pipe.session !=null &&pipes[i] !=null
192204
&&pipe.session.equals(pipes[i].session))) {
193205
pipes[i] =null;
194206
lastSetup =System.currentTimeMillis();
207+
pipe.pipeKey =null;
195208
returntrue;
196209
}
197210
}

‎sources/net.sf.j2s.ajax/ajaxpipe/net/sf/j2s/ajax/CompoundPipeSession.java‎

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public static final class PipeSessionClosedEvent extends CompoundSerializable {
1212

1313
@Override
1414
publicvoidajaxRun() {
15+
lastLiveDetected =System.currentTimeMillis();
1516
SimplePipeRunnablepipe =SimplePipeHelper.getPipe(pipeKey);
1617
if (pipe !=null) {
1718
pipeAlive =pipeSetup();
@@ -42,7 +43,11 @@ public void pipeCreated() {
4243

4344
@Override
4445
publicbooleanpipeDestroy() {
45-
if (!super.pipeDestroy())returnfalse;
46+
if (destroyed) {
47+
returnfalse;// already destroyed, no further destroy actions
48+
}
49+
pipeAlive =false;
50+
destroyed =true;
4651

4752
/**
4853
* @j2sNative
@@ -54,6 +59,9 @@ public boolean pipeDestroy() {
5459
}
5560

5661
SimplePipeRunnablepipe =SimplePipeHelper.getPipe(pipeKey);
62+
if (pipe ==null) {
63+
pipe =parent;
64+
}
5765
if (pipeinstanceofCompoundPipeRunnable) {
5866
CompoundPipeRunnablecp = (CompoundPipeRunnable)pipe;
5967
if (cp.status <3) {
@@ -62,6 +70,7 @@ public boolean pipeDestroy() {
6270
cp.unweave(this);
6371
}
6472
session =null;
73+
pipeKey =null;
6574
returntrue;
6675
}
6776

@@ -82,6 +91,8 @@ final public SimpleSerializable[] through(Object... args) {
8291

8392
@Override
8493
publicvoidpipeThrough(Object...args) {
94+
if (args ==null ||args.length ==0)return;
95+
8596
SimplePipeRunnablepipe =SimplePipeHelper.getPipe(pipeKey);
8697
if (!(pipeinstanceofCompoundPipeRunnable))return;
8798
CompoundPipeRunnablecp = (CompoundPipeRunnable)pipe;
@@ -123,6 +134,9 @@ public boolean deal(PipeSessionClosedEvent evt) {
123134
}
124135
this.updateStatus(false);
125136
SimplePipeRunnablepipe =SimplePipeHelper.getPipe(this.pipeKey);
137+
if (pipe ==null) {
138+
pipe =this.parent;
139+
}
126140
if (pipeinstanceofCompoundPipeRunnable) {
127141
CompoundPipeRunnablep = (CompoundPipeRunnable)pipe;
128142
if (p.pipes !=null) {
@@ -134,12 +148,12 @@ public boolean deal(PipeSessionClosedEvent evt) {
134148
}
135149
}
136150
}
137-
138-
if (!p.isPipeLive()) {
139-
StringpipeKey =this.pipeKey;
140-
p.pipeDestroy();
141-
SimplePipeHelper.removePipe(pipeKey);
142-
}
151+
}
152+
153+
if (pipe !=null && !pipe.isPipeLive()) {
154+
StringpipeKey =this.pipeKey;
155+
pipe.pipeDestroy();
156+
SimplePipeHelper.removePipe(pipeKey);
143157
}
144158
returntrue;
145159
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp