protected ObserverNotifier(String contextId, TypeSafeObserverResolver resolver, ServiceRegistry services, boolean strict) { this.resolver = resolver; this.sharedObjectCache = services.get(SharedObjectCache.class); this.strict = strict; this.currentEventMetadata = services.get(CurrentEventMetadata.class); if (strict) { this.eventTypeCheckCache = ComputingCacheBuilder.newBuilder().build(new EventTypeCheck()); } else { // not necessary this.eventTypeCheckCache = null; } // fall back to FJP.commonPool() if ExecutorServices are not installed this.asyncEventExecutor = services.getOptional(ExecutorServices.class).map((e) -> e.getTaskExecutor()).orElse(ForkJoinPool.commonPool()); // ScheduledExecutor might have null value this.timerExecutor = services.getOptional(ExecutorServices.class).map((e) -> e.getTimerExecutor()).orElse(null); this.securityServices = services.getRequired(SecurityServices.class); // LazyValueHolder is used because contexts are not ready yet at the point when ObserverNotifier is first initialized this.requestContextHolder = LazyValueHolder .forSupplier(() -> Container.instance(contextId).deploymentManager().instance().select(RequestContext.class, UnboundLiteral.INSTANCE).get()); }
protected ObserverNotifier(String contextId, TypeSafeObserverResolver resolver, ServiceRegistry services, boolean strict) { this.resolver = resolver; this.sharedObjectCache = services.get(SharedObjectCache.class); this.strict = strict; this.currentEventMetadata = services.get(CurrentEventMetadata.class); if (strict) { this.eventTypeCheckCache = ComputingCacheBuilder.newBuilder().build(new EventTypeCheck()); } else { // not necessary this.eventTypeCheckCache = null; } // fall back to FJP.commonPool() if ExecutorServices are not installed this.asyncEventExecutor = services.getOptional(ExecutorServices.class).map((e) -> e.getTaskExecutor()).orElse(ForkJoinPool.commonPool()); // ScheduledExecutor might have null value this.timerExecutor = services.getOptional(ExecutorServices.class).map((e) -> e.getTimerExecutor()).orElse(null); this.securityServices = services.getRequired(SecurityServices.class); // LazyValueHolder is used because contexts are not ready yet at the point when ObserverNotifier is first initialized this.requestContextHolder = LazyValueHolder .forSupplier(() -> Container.instance(contextId).deploymentManager().instance().select(RequestContext.class, UnboundLiteral.INSTANCE).get()); }
protected ObserverNotifier(String contextId, TypeSafeObserverResolver resolver, ServiceRegistry services, boolean strict) { this.resolver = resolver; this.sharedObjectCache = services.get(SharedObjectCache.class); this.strict = strict; this.currentEventMetadata = services.get(CurrentEventMetadata.class); if (strict) { this.eventTypeCheckCache = ComputingCacheBuilder.newBuilder().build(new EventTypeCheck()); } else { // not necessary this.eventTypeCheckCache = null; } // fall back to FJP.commonPool() if ExecutorServices are not installed this.asyncEventExecutor = services.getOptional(ExecutorServices.class).map((e) -> e.getTaskExecutor()).orElse(ForkJoinPool.commonPool()); // ScheduledExecutor might have null value this.timerExecutor = services.getOptional(ExecutorServices.class).map((e) -> e.getTimerExecutor()).orElse(null); this.securityServices = services.getRequired(SecurityServices.class); // LazyValueHolder is used because contexts are not ready yet at the point when ObserverNotifier is first initialized this.requestContextHolder = LazyValueHolder .forSupplier(() -> Container.instance(contextId).deploymentManager().instance().select(RequestContext.class, UnboundLiteral.INSTANCE).get()); }
protected ObserverNotifier(String contextId, TypeSafeObserverResolver resolver, ServiceRegistry services, boolean strict) { this.resolver = resolver; this.sharedObjectCache = services.get(SharedObjectCache.class); this.strict = strict; this.currentEventMetadata = services.get(CurrentEventMetadata.class); if (strict) { this.eventTypeCheckCache = ComputingCacheBuilder.newBuilder().build(new EventTypeCheck()); } else { // not necessary this.eventTypeCheckCache = null; } // fall back to FJP.commonPool() if ExecutorServices are not installed this.asyncEventExecutor = services.getOptional(ExecutorServices.class).map((e) -> e.getTaskExecutor()).orElse(ForkJoinPool.commonPool()); // ScheduledExecutor might have null value this.timerExecutor = services.getOptional(ExecutorServices.class).map((e) -> e.getTimerExecutor()).orElse(null); this.securityServices = services.getRequired(SecurityServices.class); // LazyValueHolder is used because contexts are not ready yet at the point when ObserverNotifier is first initialized this.requestContextHolder = LazyValueHolder .forSupplier(() -> Container.instance(contextId).deploymentManager().instance().select(RequestContext.class, UnboundLiteral.INSTANCE).get()); }
protected ObserverNotifier(String contextId, TypeSafeObserverResolver resolver, ServiceRegistry services, boolean strict) { this.resolver = resolver; this.sharedObjectCache = services.get(SharedObjectCache.class); this.strict = strict; this.currentEventMetadata = services.get(CurrentEventMetadata.class); if (strict) { this.eventTypeCheckCache = ComputingCacheBuilder.newBuilder().build(new EventTypeCheck()); } else { // not necessary this.eventTypeCheckCache = null; } // fall back to FJP.commonPool() if ExecutorServices are not installed this.asyncEventExecutor = services.getOptional(ExecutorServices.class).map((e) -> e.getTaskExecutor()).orElse(ForkJoinPool.commonPool()); // ScheduledExecutor might have null value this.timerExecutor = services.getOptional(ExecutorServices.class).map((e) -> e.getTimerExecutor()).orElse(null); this.securityServices = services.getRequired(SecurityServices.class); // LazyValueHolder is used because contexts are not ready yet at the point when ObserverNotifier is first initialized this.requestContextHolder = LazyValueHolder .forSupplier(() -> Container.instance(contextId).deploymentManager().instance().select(RequestContext.class, UnboundLiteral.INSTANCE).get()); }
protected ObserverNotifier(TypeSafeObserverResolver resolver, ServiceRegistry services, boolean strict) { this.resolver = resolver; this.sharedObjectCache = services.get(SharedObjectCache.class); this.strict = strict; this.currentEventMetadata = services.get(CurrentEventMetadata.class); if (strict) { this.eventTypeCheckCache = ComputingCacheBuilder.newBuilder().build(new EventTypeCheck()); } else { // not necessary this.eventTypeCheckCache = null; } }