java类java.beans.beancontext.BeanContextServicesSupport的实例源码

Test4328406.java 文件源码 项目:jdk8u-dev-jdk 阅读 19 收藏 0 点赞 0 评论 0
public static void main(String[] args) {
    for (int i = 0; i < 10; i++) {
        BeanContextServices container = new BeanContextServicesSupport();
        BeanContextChild ms1 = new MyService1();
        BeanContextServices ms2 = new MyService2();
        BeanContextChild mb = new MyBean();

        container.add(ms1);
        container.add(ms2);
        ms2.add(mb);

        // exception thrown here
        container.remove(ms2);
    }
}
Test4328406.java 文件源码 项目:jdk8u-dev-jdk 阅读 24 收藏 0 点赞 0 评论 0
protected void initializeBeanContextResources() {
    super.initializeBeanContextResources();

    BeanContextServicesSupport bcs = (BeanContextServicesSupport) getBeanContext();
    try {
        bcs.getService(this, this, MyService1.class, null, this);
    }
    catch (Exception exception) {
        exception.printStackTrace();
    }
    bcs.addService(this.getClass(), this);
}
Test4328406.java 文件源码 项目:jdk7-jdk 阅读 21 收藏 0 点赞 0 评论 0
public static void main(String[] args) {
    for (int i = 0; i < 10; i++) {
        BeanContextServices container = new BeanContextServicesSupport();
        BeanContextChild ms1 = new MyService1();
        BeanContextServices ms2 = new MyService2();
        BeanContextChild mb = new MyBean();

        container.add(ms1);
        container.add(ms2);
        ms2.add(mb);

        // exception thrown here
        container.remove(ms2);
    }
}
Test4328406.java 文件源码 项目:jdk7-jdk 阅读 36 收藏 0 点赞 0 评论 0
protected void initializeBeanContextResources() {
    super.initializeBeanContextResources();

    BeanContextServicesSupport bcs = (BeanContextServicesSupport) getBeanContext();
    try {
        bcs.getService(this, this, MyService1.class, null, this);
    }
    catch (Exception exception) {
        exception.printStackTrace();
    }
    bcs.addService(this.getClass(), this);
}
Test4328406.java 文件源码 项目:openjdk-source-code-learn 阅读 18 收藏 0 点赞 0 评论 0
public static void main(String[] args) {
    for (int i = 0; i < 10; i++) {
        BeanContextServices container = new BeanContextServicesSupport();
        BeanContextChild ms1 = new MyService1();
        BeanContextServices ms2 = new MyService2();
        BeanContextChild mb = new MyBean();

        container.add(ms1);
        container.add(ms2);
        ms2.add(mb);

        // exception thrown here
        container.remove(ms2);
    }
}
Test4328406.java 文件源码 项目:openjdk-source-code-learn 阅读 27 收藏 0 点赞 0 评论 0
protected void initializeBeanContextResources() {
    super.initializeBeanContextResources();

    BeanContextServicesSupport bcs = (BeanContextServicesSupport) getBeanContext();
    try {
        bcs.getService(this, this, MyService1.class, null, this);
    }
    catch (Exception exception) {
        exception.printStackTrace();
    }
    bcs.addService(this.getClass(), this);
}
Test4328406.java 文件源码 项目:OLD-OpenJDK8 阅读 20 收藏 0 点赞 0 评论 0
public static void main(String[] args) {
    for (int i = 0; i < 10; i++) {
        BeanContextServices container = new BeanContextServicesSupport();
        BeanContextChild ms1 = new MyService1();
        BeanContextServices ms2 = new MyService2();
        BeanContextChild mb = new MyBean();

        container.add(ms1);
        container.add(ms2);
        ms2.add(mb);

        // exception thrown here
        container.remove(ms2);
    }
}
Test4328406.java 文件源码 项目:OLD-OpenJDK8 阅读 30 收藏 0 点赞 0 评论 0
protected void initializeBeanContextResources() {
    super.initializeBeanContextResources();

    BeanContextServicesSupport bcs = (BeanContextServicesSupport) getBeanContext();
    try {
        bcs.getService(this, this, MyService1.class, null, this);
    }
    catch (Exception exception) {
        exception.printStackTrace();
    }
    bcs.addService(this.getClass(), this);
}
BeanContextServicesSupport2Test.java 文件源码 项目:cn1 阅读 23 收藏 0 点赞 0 评论 0
public void test() {
    BeanContextServiceProvider bcsp = new BCSP();
    BCSS serviceSupport = new BCSS(new BeanContextServicesSupport());
    assertTrue("Expected first addService to return true", serviceSupport
            .addService(Boolean.TYPE, bcsp, false));
    assertFalse("Expected second addService to return false", serviceSupport
            .addService(Boolean.TYPE, bcsp, false));
}
BeanContextServicesSupportTest.java 文件源码 项目:cn1 阅读 23 收藏 0 点赞 0 评论 0
public void testServiceRevoked() {
    MockChildBeanContextServicesSupport mockChildBeanContextServicesSupport = new MockChildBeanContextServicesSupport();
    BeanContextServicesSupport beanContextServicesSupport = new BeanContextServicesSupport();
    beanContextServicesSupport.add(mockChildBeanContextServicesSupport);
    BeanContextServiceRevokedEvent beanContextServiceRevokedEvent = new BeanContextServiceRevokedEvent(new BeanContextServicesSupport(), Collection.class,false);
    beanContextServicesSupport.serviceRevoked(beanContextServiceRevokedEvent);
    assertTrue(mockChildBeanContextServicesSupport.revokeCalled);        
}


问题


面经


文章

微信
公众号

扫码关注公众号