Skip to content

Commit f6dd49e

Browse files
committed
fix classlaoder setting
1 parent dca34c2 commit f6dd49e

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/main/java/com/alipay/remoting/rpc/RpcInvokeCallbackListener.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,8 @@
2121
import com.alipay.remoting.*;
2222
import org.slf4j.Logger;
2323

24-
import com.alipay.remoting.exception.CodecException;
25-
import com.alipay.remoting.exception.ConnectionClosedException;
2624
import com.alipay.remoting.log.BoltLoggerFactory;
2725
import com.alipay.remoting.rpc.exception.InvokeException;
28-
import com.alipay.remoting.rpc.exception.InvokeServerBusyException;
29-
import com.alipay.remoting.rpc.exception.InvokeServerException;
30-
import com.alipay.remoting.rpc.exception.InvokeTimeoutException;
31-
import com.alipay.remoting.rpc.protocol.RpcResponseCommand;
3226

3327
/**
3428
* Listener which listens the Rpc invoke result, and then invokes the call back.
@@ -126,15 +120,15 @@ public void run() {
126120
+ ResponseStatus.UNKNOWN, future.getCause());
127121
}
128122

129-
Object responseObj = RpcResponseResolver.resolveResponseObject(response,
130-
this.remoteAddress);
131-
132123
ClassLoader oldClassLoader = null;
133124
try {
134125
if (future.getAppClassLoader() != null) {
135126
oldClassLoader = Thread.currentThread().getContextClassLoader();
136127
Thread.currentThread().setContextClassLoader(future.getAppClassLoader());
137128
}
129+
130+
Object responseObj = RpcResponseResolver.resolveResponseObject(response,
131+
this.remoteAddress);
138132
response.setInvokeContext(future.getInvokeContext());
139133
try {
140134
callback.onResponse(responseObj);
@@ -159,6 +153,7 @@ public void run() {
159153
.error(
160154
"Exception occurred in user defined InvokeCallback#onException() logic, The address is {}",
161155
this.remoteAddress, te);
156+
// Consider rethrowing the exception or handling it according to your application's needs
162157
}
163158
}
164159

0 commit comments

Comments
 (0)