Search in sources :

Example 1 with BeanContextServices

use of java.beans.beancontext.BeanContextServices in project jdk8u_jdk by JetBrains.

the class MyBean method main.

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);
    }
}
Also used : BeanContextServicesSupport(java.beans.beancontext.BeanContextServicesSupport) BeanContextChild(java.beans.beancontext.BeanContextChild) BeanContextServices(java.beans.beancontext.BeanContextServices)

Example 2 with BeanContextServices

use of java.beans.beancontext.BeanContextServices in project jdk8u_jdk by JetBrains.

the class MyBean method releaseBeanContextResources.

protected void releaseBeanContextResources() {
    super.releaseBeanContextResources();
    BeanContextServices bcs = (BeanContextServices) getBeanContext();
    bcs.revokeService(this.getClass(), this, true);
}
Also used : BeanContextServices(java.beans.beancontext.BeanContextServices)

Example 3 with BeanContextServices

use of java.beans.beancontext.BeanContextServices in project jdk8u_jdk by JetBrains.

the class MyBean method initializeBeanContextResources.

protected void initializeBeanContextResources() {
    super.initializeBeanContextResources();
    BeanContextServices bcs = (BeanContextServices) getBeanContext();
    try {
        bcs.getService(this, this, MyService1.class, null, this);
    } catch (Exception exception) {
        exception.printStackTrace();
    }
    try {
        bcs.getService(this, this, MyService2.class, null, this);
    } catch (Exception exception) {
        exception.printStackTrace();
    }
}
Also used : BeanContextServices(java.beans.beancontext.BeanContextServices)

Aggregations

BeanContextServices (java.beans.beancontext.BeanContextServices)3 BeanContextChild (java.beans.beancontext.BeanContextChild)1 BeanContextServicesSupport (java.beans.beancontext.BeanContextServicesSupport)1