Child   <-   many-to-one   ->Parent   
    
  class   Child   {   
      private   Parent   parent;   
    
      public   Parent   getParent   (){   
          return   this.parent;//访问了实例变量   
      }   
        
  }   
    
  class   Parent   {   
      private   String   name;   
    
      public   String   getName(){   
          return   this.name;//访问了实例变量   
      }   
    
      public   void   f(){   
          System.out.println("invokeing   f()");//没有访问实例变量   
      }   
  }   
    
  如果   many-to-one   的lazy设为proxy,当child.getParent().getName()或child.getParent().f()时,parent都会被抓取,若设为no-proxy,调用child.getParent().f()时,parent是不会被抓取的,同时这种方式需要编译时字节码增强,否则和proxy没区别。

Child   <-   many-to-one   ->Parent   
    
  class   Child   {   
      private   Parent   parent;   
    
      public   Parent   getParent   (){   
          return   this.parent;//访问了实例变量   
      }   
        
  }   
    
  class   Parent   {   
      private   String   name;   
    
      public   String   getName(){   
          return   this.name;//访问了实例变量   
      }   
    
      public   void   f(){   
          System.out.println("invokeing   f()");//没有访问实例变量   
      }   
  }   
    
  如果   many-to-one   的lazy设为proxy,当child.getParent().getName()或child.getParent().f()时,parent都会被抓取,若设为no-proxy,调用child.getParent().f()时,parent是不会被抓取的,同时这种方式需要编译时字节码增强,否则和proxy没区别。

相关文章:

  • 2021-04-16
  • 2022-12-23
  • 2021-11-15
  • 2021-11-12
  • 2021-08-31
  • 2022-12-23
  • 2022-12-23
  • 2021-11-14
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-08-09
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案