Skip to content

ReferenceBean.getCallProxy()在dubbo3.1.5版本与3.0.4版本的不同?? #12623

@gulangduchuangtianyu

Description

@gulangduchuangtianyu
private Object getCallProxy() throws Exception {
    if (referenceConfig == null) {
        throw new IllegalStateException("ReferenceBean is not ready yet, please make sure to call reference interface method after dubbo is started.");
    }
    //get reference proxy
    //Subclasses should synchronize on the given Object if they perform any sort of extended singleton creation phase.
    // In particular, subclasses should not have their own mutexes involved in singleton creation, to avoid the potential for deadlocks in lazy-init situations.
    //The redundant type cast is to be compatible with earlier than spring-4.2
    synchronized (((DefaultSingletonBeanRegistry)getBeanFactory()).getSingletonMutex()) {
        return referenceConfig.get();
    }
}

在dubbo3.1.5中为啥要加 synchronized ???目的是什么,主要解决什么问题

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions