You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using sofa-bolt , user can extends com.alipay.remoting.rpc.protocol.SyncUserProcessor and implement some interface such as com.alipay.antschedulerclient.rpc.processor.ClusterJobSplitProcessor#getExecutor to assign User ThreadPool. But when self defined user processor is run in sofa-bolt code com.alipay.remoting.rpc.protocol.RpcRequestProcessor#process`:
* @see com.alipay.remoting.AbstractRemotingProcessor#process(com.alipay.remoting.RemotingContext, com.alipay.remoting.RemotingCommand, java.util.concurrent.ExecutorService)
*/
@Override
public void process(RemotingContext ctx, RpcRequestCommand cmd, ExecutorService defaultExecutor)
throws Exception {
UserProcessor userProcessor = ctx.getUserProcessor(cmd.getRequestClass());
// simplify codes
// Till now, if executor still null, then try default
if (executor == null) {
executor = (this.getExecutor() == null ? defaultExecutor : this.getExecutor());
}
// use the final executor dispatch process task
executor.execute(new ProcessTask(ctx, cmd));
}
In executor.execute(new ProcessTask(ctx, cmd)) codes will call com.alipay.remoting.serialization.HessianSerializer#deserialize ,but when the Thread.currentThread().getContextClassLoader() is Container or Web Framework ClassLoader may cause deserialize failed ,and cause some user classed deserialized as java.util.HashMap.
Expected behavior
Thread.currentThread().getContextClassLoader() can self-defined and when submit user processor in code executor.execute(new ProcessTask(ctx, cmd)); using Thread.currentThread().setContextClassLoader to set and com.alipay.remoting.serialization.HessianSerializer#deserialize can deserialize actual user expected classes
Actual behavior
Thread.currentThread().setContextClassLoadercan't be set andcom.alipay.remoting.serialization.HessianSerializer#deserializefailed ,user classes are deserialized asjava.util.HashMap` using Hessian
Steps to reproduce
Have Self defined ClassLoader Container and Thread.currentThread().getContextClassLoader() not expected
Environment
All SOFABolt version have the same problems and can't set user Thread Context ClassLoader
SOFABolt version:
JVM version (e.g. java -version):
OS version (e.g. uname -a):
Maven version:
IDE version:
The text was updated successfully, but these errors were encountered:
* fix code style
* fix#210
* fix#210
* fix#222
* support check and create connection in async way
* return false if no connection and try create in async way
* switch ClassLoader in try-finally
Describe the bug
When using sofa-bolt , user can extends
com.alipay.remoting.rpc.protocol.SyncUserProcessor
and implement some interface such ascom.alipay.antschedulerclient.rpc.processor.ClusterJobSplitProcessor#getExecutor
to assign User ThreadPool. But when self defined user processor is run in sofa-bolt code
com.alipay.remoting.rpc.protocol.RpcRequestProcessor#process`:In
executor.execute(new ProcessTask(ctx, cmd))
codes will callcom.alipay.remoting.serialization.HessianSerializer#deserialize
,but when theThread.currentThread().getContextClassLoader()
is Container or Web Framework ClassLoader may cause deserialize failed ,and cause some user classed deserialized asjava.util.HashMap
.Expected behavior
Thread.currentThread().getContextClassLoader()
can self-defined and when submit user processor in codeexecutor.execute(new ProcessTask(ctx, cmd));
usingThread.currentThread().setContextClassLoader
to set andcom.alipay.remoting.serialization.HessianSerializer#deserialize
can deserialize actual user expected classesActual behavior
Thread.currentThread().setContextClassLoader
can't be set and
com.alipay.remoting.serialization.HessianSerializer#deserializefailed ,user classes are deserialized as
java.util.HashMap` using HessianSteps to reproduce
Have Self defined ClassLoader Container and
Thread.currentThread().getContextClassLoader()
not expectedEnvironment
All SOFABolt version have the same problems and can't set user Thread Context ClassLoader
java -version
):uname -a
):The text was updated successfully, but these errors were encountered: