public void close() { if (iref != null) { // Last registration, remove the ExportReference from the ExportRegistry if (registrations.remove(iref.getImportedEndpoint(), this)) { getRoseMachine().removeLocal(iref); destroyProxy(iref.getImportedEndpoint(), iref.getRegistration()); iref.close(); // Safe close (unregister the proxy if forgotten) } iref = null; // is now closed } }
/** * Stop the proxy-creator, iPOJO Invalidate instance callback. Must be override ! Close all * endpoints. */ protected void stop() { synchronized (registrations) { Collection<EndpointDescription> descs = registrations.keySet(); for (EndpointDescription desc : descs) { MyImportReference iref = registrations.getElem(desc).getImportReference(); destroyProxy(iref.getImportedEndpoint(), iref.getRegistration()); // TODO check != null iref.close(); // unregister the proxy } registrations.clear(); isValid = false; } }
private MyImportRegistration(EndpointDescription desc, ServiceRegistration registration) { // Create the MyImportReference iref = new MyImportReference(desc, registration); // Add the registration to the registrations mapOfSet registrations.add(iref.getImportedEndpoint(), this); }