Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

ExtensionLoader print exception #278

Closed
leizhiyuan opened this issue Aug 22, 2018 · 3 comments
Closed

ExtensionLoader print exception #278

leizhiyuan opened this issue Aug 22, 2018 · 3 comments

Comments

@leizhiyuan
Copy link
Contributor

Your question

com.alipay.sofa.rpc.ext.ExtensionLoader#readLine

try {
            tmp = ClassUtils.forName(className, false);
        } catch (Throwable e) {
            if (LOGGER.isWarnEnabled()) {
                LOGGER.warn("Extension {} of extensible {} is disabled, cause by: {}",
                    className, interfaceName, ExceptionUtils.toShortString(e, 2));
            }
            return;
        }

Your scenes

describe your use scenes (why need this feature)

Your advice

maybe we don't need to catch Throwable?

or we can print ExceptionUtils.toString(e)?

Environment

  • SOFARPC version:
  • JVM version (e.g. java -version):
  • OS version (e.g. uname -a):
  • Maven version:
  • IDE version:
@ujjboy
Copy link
Member

ujjboy commented Aug 22, 2018

The question is we don't know why user don't import classes.

For example:
Registry has three extensions: zookeeper, dsr, consul

If user want use zookeeper as registry, and did not import dsr.jar and consul.jar, dsr and consul registry extension will disabled, we need ignore it.

But if user did not import zookeeper.jar, zookeeper registry will disabled, too. It's better to throw exception when not found extension ( get registry from RegistryFactory).

@ujjboy
Copy link
Member

ujjboy commented Aug 22, 2018

Now, these three factory did not throw exception when not found extension:
CompressorFactory, SerializerFactory, ProtocolFactory

@ujjboy
Copy link
Member

ujjboy commented Aug 22, 2018

At ExtensionLoader#readLine, we can add extra DEBUG exception stack trace.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants