@Override
    public Deserializer getDeserializer(String type) throws HessianProtocolException {

        // 如果类型在过滤列表, 说明是jdk自带类, 直接委托父类处理
        if (StringUtils.isEmpty(type) || ClassFilter.filterExcludeClass(type)) {
            return super.getDeserializer(type);
        }

        // 如果是数组类型, 且在name过滤列表, 说明jdk类, 直接委托父类处理
        if (type.charAt(0) == ARRAY_PREFIX && ClassFilter.arrayFilter(type)) {
            return super.getDeserializer(type);
        }

        // 查看是否已经包含反序列化器
        Deserializer deserializer = DESERIALIZER_MAP.get(type);
        if (deserializer != null) {
            return deserializer;
        }

        // 自定义Throwable采用JavaDeserializer，反序列化成Throwable而不是GenericObject
        deserializer = getDeserializerForCustomThrowable(type);
        if (deserializer != null) {
            DESERIALIZER_MAP.putIfAbsent(type, deserializer);
            return deserializer;
        }

        // 新建反序列化器, 如果是java.lang.Class使用GenericClassDeserializer,否则使用GenericDeserializer
        if (ClassFilter.CLASS_NAME.equals(type)) {
            deserializer = GenericClassDeserializer.getInstance();
        } else {
            deserializer = new GenericDeserializer(type);
        }

        DESERIALIZER_MAP.putIfAbsent(type, deserializer);
        return deserializer;
    }
@Test
    public void testCustomThrowableDeserializerEnabled() throws Exception {
        setGenericThrowException(true);
        try {
            GenericSingleClassLoaderSofaSerializerFactory factory = new GenericSingleClassLoaderSofaSerializerFactory();

            ByteArrayOutputStream bsOut = new ByteArrayOutputStream();
            Hessian2Output hessian2Output = new Hessian2Output(bsOut);
            hessian2Output.setSerializerFactory(factory);

            MockError mockError = new MockError("MockError");
            hessian2Output.writeObject(mockError);
            hessian2Output.flush();

            Deserializer javaDeserializer = factory.getDeserializer(MockError.class.getName());
            Assert.assertTrue(javaDeserializer instanceof JavaDeserializer);

            ByteArrayInputStream bsIn = new ByteArrayInputStream(bsOut.toByteArray());
            Hessian2Input hessian2Input = new Hessian2Input(bsIn);
            hessian2Input.setSerializerFactory(factory);
            Object result = hessian2Input.readObject();
            Assert.assertTrue(result instanceof MockError);
            Assert.assertEquals("MockError", ((MockError) result).getMessage());
        } finally {
            setGenericThrowException(false);
            clearCacheDeserializerMap();
        }
    }