Package org.iosgi

Examples of org.iosgi.IsolationEnvironment


    throw new IOException("no matching factory found (" + parent + ")");
  }

  @Override
  public void destroy(final URI id) throws Exception {
    IsolationEnvironment env = getEnvironment(id);
    final Semaphore s = new Semaphore(0);
    ServiceListener l = new ServiceListener() {
      @Override
      public void serviceChanged(ServiceEvent event) {
        if (event.getType() != ServiceEvent.UNREGISTERING) {
          return;
        }
        ServiceReference ref = event.getServiceReference();
        String[] objClasses = (String[]) ref.getProperty("objectClass");
        boolean contains = Arrays.binarySearch(objClasses,
            IsolationEnvironment.class.getName()) >= 0;
        if (contains && ref.getProperty("environment.id").equals(id)) {
          s.release();
        }
      }
    };
    context.addServiceListener(l);
    try {
      env.destroy();
      s.acquire();
    } finally {
      context.removeServiceListener(l);
    }
  }
View Full Code Here

TOP

Related Classes of org.iosgi.IsolationEnvironment

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.