public void bind(final Name name, final Object object) throws NamingException { final Object owner = requireOwner(); final ServiceName bindName = buildServiceName(name); bind(name, object, owner, bindName); }
public void unbind(final Name name) throws NamingException { requireOwner(); final ServiceName bindName = buildServiceName(name); final ServiceController<?> controller = getServiceRegistry().getService(bindName); if (controller == null) { throw NamingLogger.ROOT_LOGGER.cannotResolveService(bindName); } controller.setMode(ServiceController.Mode.REMOVE); final StabilityMonitor monitor = new StabilityMonitor(); monitor.addController(controller); try { monitor.awaitStability(); } catch (Exception e) { throw namingException("Failed to unbind [" + bindName + "]", e); } finally { monitor.removeController(controller); } }
public void rebind(Name name, Object object) throws NamingException { final Object owner = requireOwner(); // re-set the existent binder service injected value final ServiceName bindName = buildServiceName(name); final ServiceController<?> controller = getServiceRegistry().getService(bindName); if (controller == null) { bind(name, object, owner, bindName); } else { final BinderService binderService = (BinderService) controller.getService(); if (owner instanceof ServiceName) { final ServiceName deploymentUnitServiceName = (ServiceName) owner; binderService.acquire(); final RuntimeBindReleaseService.References duBindingReferences = (RuntimeBindReleaseService.References) controller.getServiceContainer().getService(JndiNamingDependencyProcessor.serviceName(deploymentUnitServiceName)).getValue(); duBindingReferences.add(binderService); } binderService.getManagedObjectInjector().setValue(new ImmediateValue(new ImmediateManagedReferenceFactory(object))); } }
public void bind(final Name name, final Object object) throws NamingException { final Object owner = requireOwner(); final ServiceName bindName = buildServiceName(name); bind(name, object, owner, bindName); }
public void bind(final Name name, final Object object) throws NamingException { final Object owner = requireOwner(); final ServiceName bindName = buildServiceName(name); bind(name, object, owner, bindName); }
public void bind(final Name name, final Object object) throws NamingException { final ServiceName deploymentUnitServiceName = requireOwner(); final ServiceName bindName = buildServiceName(name); bind(name, bindName, object, deploymentUnitServiceName); }
public void rebind(Name name, Object object) throws NamingException { final ServiceName deploymentUnitServiceName = requireOwner(); final ServiceName bindName = buildServiceName(name); try { unbind(name, bindName); } catch (NamingException ignore) { // rebind may fail if there is no existing binding } bind(name, bindName, object, deploymentUnitServiceName); }
@SuppressWarnings("unchecked") public void unbind(final Name name) throws NamingException { final ServiceName deploymentUnitServiceName = requireOwner(); final ServiceName bindName = buildServiceName(name); // do the unbinding unbind(name, bindName); // remove the service name from runtime bindings management service final Set<ServiceName> duBindingReferences = (Set<ServiceName>) getServiceRegistry().getService(JndiNamingDependencyProcessor.serviceName(deploymentUnitServiceName)).getValue(); duBindingReferences.remove(bindName); }
public void unbind(final Name name) throws NamingException { requireOwner(); final ServiceName bindName = buildServiceName(name); final ServiceController<?> controller = getServiceRegistry().getService(bindName); if (controller == null) { throw NamingLogger.ROOT_LOGGER.cannotResolveService(bindName); } controller.setMode(ServiceController.Mode.REMOVE); final StabilityMonitor monitor = new StabilityMonitor(); monitor.addController(controller); try { monitor.awaitStability(); } catch (Exception e) { throw namingException("Failed to unbind [" + bindName + "]", e); } finally { monitor.removeController(controller); } }
public void unbind(final Name name) throws NamingException { requireOwner(); final ServiceName bindName = buildServiceName(name); final ServiceController<?> controller = getServiceRegistry().getService(bindName); if (controller == null) { throw NamingLogger.ROOT_LOGGER.cannotResolveService(bindName); } controller.setMode(ServiceController.Mode.REMOVE); final StabilityMonitor monitor = new StabilityMonitor(); monitor.addController(controller); try { monitor.awaitStability(); } catch (Exception e) { throw namingException("Failed to unbind [" + bindName + "]", e); } finally { monitor.removeController(controller); } }
public void rebind(Name name, Object object) throws NamingException { final Object owner = requireOwner(); // re-set the existent binder service injected value final ServiceName bindName = buildServiceName(name); final ServiceController<?> controller = getServiceRegistry().getService(bindName); if (controller == null) { bind(name, object, owner, bindName); } else { final BinderService binderService = (BinderService) controller.getService(); if (owner instanceof ServiceName) { final ServiceName deploymentUnitServiceName = (ServiceName) owner; binderService.acquire(); final RuntimeBindReleaseService.References duBindingReferences = (RuntimeBindReleaseService.References) controller.getServiceContainer().getService(JndiNamingDependencyProcessor.serviceName(deploymentUnitServiceName)).getValue(); duBindingReferences.add(binderService); } binderService.getManagedObjectInjector().setValue(new ImmediateValue(new ImmediateManagedReferenceFactory(object))); } }
public void rebind(Name name, Object object) throws NamingException { final Object owner = requireOwner(); // re-set the existent binder service injected value final ServiceName bindName = buildServiceName(name); final ServiceController<?> controller = getServiceRegistry().getService(bindName); if (controller == null) { bind(name, object, owner, bindName); } else { final BinderService binderService = (BinderService) controller.getService(); if (owner instanceof ServiceName) { final ServiceName deploymentUnitServiceName = (ServiceName) owner; binderService.acquire(); final RuntimeBindReleaseService.References duBindingReferences = (RuntimeBindReleaseService.References) controller.getServiceContainer().getService(JndiNamingDependencyProcessor.serviceName(deploymentUnitServiceName)).getValue(); duBindingReferences.add(binderService); } binderService.getManagedObjectInjector().setValue(new ImmediateValue(new ImmediateManagedReferenceFactory(object))); } }