Package org.springframework.aop.target

Examples of org.springframework.aop.target.HotSwappableTargetSource


    pc.setTarget(tb2);
    assertEquals(tb2.getAge(), proxy.getAge());
    assertEquals(nop.getCount(), 2);

    // Change to a new dynamic target
    HotSwappableTargetSource hts = new HotSwappableTargetSource(tb3);
    pc.setTargetSource(hts);
    assertEquals(tb3.getAge(), proxy.getAge());
    assertEquals(nop.getCount(), 3);
    hts.swap(tb1);
    assertEquals(tb1.getAge(), proxy.getAge());
    tb1.setName("Colin");
    assertEquals(tb1.getName(), proxy.getName());
    assertEquals(nop.getCount(), 5);
View Full Code Here


    tb.setAge(newAge);
    assertEquals(newAge, tb.getAge());
   
    TestBean target2 = new TestBean();
    target2.setAge(65);
    HotSwappableTargetSource ts = (HotSwappableTargetSource) factory.getBean("swapper");
    ts.swap(target2);
    assertEquals(target2.getAge(), tb.getAge());
    tb.setAge(newAge);
    assertEquals(newAge, target2.getAge());
   
    assertEquals(0, txMan.inflight);
View Full Code Here

    pc.setTarget(tb2);
    assertEquals(tb2.getAge(), proxy.getAge());
    assertEquals(nop.getCount(), 2);

    // Change to a new dynamic target
    HotSwappableTargetSource hts = new HotSwappableTargetSource(tb3);
    pc.setTargetSource(hts);
    assertEquals(tb3.getAge(), proxy.getAge());
    assertEquals(nop.getCount(), 3);
    hts.swap(tb1);
    assertEquals(tb1.getAge(), proxy.getAge());
    tb1.setName("Colin");
    assertEquals(tb1.getName(), proxy.getName());
    assertEquals(nop.getCount(), 5);
View Full Code Here

    tb.setAge(newAge);
    assertEquals(newAge, tb.getAge());

    TestBean target2 = new TestBean();
    target2.setAge(65);
    HotSwappableTargetSource ts = (HotSwappableTargetSource) factory.getBean("swapper");
    ts.swap(target2);
    assertEquals(target2.getAge(), tb.getAge());
    tb.setAge(newAge);
    assertEquals(newAge, target2.getAge());

    assertEquals(0, txMan.inflight);
View Full Code Here

  @Override
  public boolean processBeanMethodReturnValue(BeanFactory childBeanFactory, Object originallyCreatedBean,
      Method method, ProxyFactory pf) {
    if (hotswapMethods.contains(method)) {
      HotSwappableTargetSource hsts = new HotSwappableTargetSource(originallyCreatedBean);
      pf.setTargetSource(hsts);
      return true;
    }
    return false;
  }
View Full Code Here

                return standbyDataSource;
            }
            return activeDataSource;
        }

        HotSwappableTargetSource targetSource = new HotSwappableTargetSource(activeDataSource);
        ProxyFactory pf = new ProxyFactory();
        pf.setInterfaces(new Class[] { DataSource.class });
        pf.setTargetSource(targetSource);
       
       
View Full Code Here

TOP

Related Classes of org.springframework.aop.target.HotSwappableTargetSource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.