use of org.wildfly.clustering.ee.infinispan.InfinispanCacheProperties in project wildfly by wildfly.
the class InfinispanBeanManagerFactory method createBeanManager.
@Override
public BeanManager<I, T, TransactionBatch> createBeanManager(IdentifierFactory<I> identifierFactory, PassivationListener<T> passivationListener, RemoveListener<T> removeListener) {
MarshallingContext context = new SimpleMarshallingContextFactory().createMarshallingContext(this.configuration.getMarshallingConfigurationRepository(), this.configuration.getBeanContext().getClassLoader());
MarshalledValueFactory<MarshallingContext> factory = new SimpleMarshalledValueFactory(context);
Cache<BeanKey<I>, BeanEntry<I>> beanCache = this.configuration.getCache();
Cache<BeanGroupKey<I>, BeanGroupEntry<I, T>> groupCache = this.configuration.getCache();
final CacheProperties properties = new InfinispanCacheProperties(groupCache.getCacheConfiguration());
final String beanName = this.configuration.getBeanContext().getBeanName();
BeanGroupFactory<I, T> groupFactory = new InfinispanBeanGroupFactory<>(groupCache, beanCache, factory, context, properties);
Configuration<BeanGroupKey<I>, BeanGroupEntry<I, T>, BeanGroupFactory<I, T>> groupConfiguration = new SimpleConfiguration<>(groupCache, groupFactory);
BeanFactory<I, T> beanFactory = new InfinispanBeanFactory<>(beanName, groupFactory, beanCache, properties, this.configuration.getBeanContext().getTimeout(), properties.isPersistent() ? passivationListener : null);
Configuration<BeanKey<I>, BeanEntry<I>, BeanFactory<I, T>> beanConfiguration = new SimpleConfiguration<>(beanCache, beanFactory);
final NodeFactory<Address> nodeFactory = this.configuration.getNodeFactory();
final Registry<String, ?> registry = this.configuration.getRegistry();
final KeyAffinityServiceFactory affinityFactory = this.configuration.getKeyAffinityServiceFactory();
final CommandDispatcherFactory dispatcherFactory = this.configuration.getCommandDispatcherFactory();
final Time timeout = this.configuration.getBeanContext().getTimeout();
final ScheduledExecutorService scheduler = this.configuration.getScheduler();
final ExpirationConfiguration<T> expiration = new ExpirationConfiguration<T>() {
@Override
public Time getTimeout() {
return timeout;
}
@Override
public RemoveListener<T> getRemoveListener() {
return removeListener;
}
@Override
public ScheduledExecutorService getExecutor() {
return scheduler;
}
};
final Executor executor = this.configuration.getExecutor();
final BeanPassivationConfiguration passivationConfig = this.configuration.getPassivationConfiguration();
final PassivationConfiguration<T> passivation = new PassivationConfiguration<T>() {
@Override
public PassivationListener<T> getPassivationListener() {
return passivationListener;
}
@Override
public BeanPassivationConfiguration getConfiguration() {
return passivationConfig;
}
@Override
public Executor getExecutor() {
return executor;
}
};
InfinispanBeanManagerConfiguration<T> configuration = new InfinispanBeanManagerConfiguration<T>() {
@Override
public String getBeanName() {
return beanName;
}
@Override
public KeyAffinityServiceFactory getAffinityFactory() {
return affinityFactory;
}
@Override
public Registry<String, ?> getRegistry() {
return registry;
}
@Override
public NodeFactory<Address> getNodeFactory() {
return nodeFactory;
}
@Override
public CommandDispatcherFactory getCommandDispatcherFactory() {
return dispatcherFactory;
}
@Override
public ExpirationConfiguration<T> getExpirationConfiguration() {
return expiration;
}
@Override
public PassivationConfiguration<T> getPassivationConfiguration() {
return passivation;
}
@Override
public CacheProperties getProperties() {
return properties;
}
};
return new InfinispanBeanManager<>(configuration, identifierFactory, beanConfiguration, groupConfiguration);
}
use of org.wildfly.clustering.ee.infinispan.InfinispanCacheProperties in project wildfly by wildfly.
the class InfinispanSSOManagerFactory method createSSOManager.
@Override
public <L, C extends Marshallability> SSOManager<A, D, S, L, TransactionBatch> createSSOManager(SSOManagerConfiguration<L, C> configuration) {
Cache<Key<String>, ?> cache = this.configuration.getCache();
CacheProperties properties = new InfinispanCacheProperties(cache.getCacheConfiguration());
SessionsFactory<Map<D, S>, D, S> sessionsFactory = new CoarseSessionsFactory<>(this.configuration.getCache(), properties);
SSOFactory<Map.Entry<A, AtomicReference<L>>, Map<D, S>, A, D, S, L> factory = new InfinispanSSOFactory<>(this.configuration.getCache(), properties, new MarshalledValueMarshaller<>(configuration.getMarshalledValueFactory(), configuration.getMarshallingContext()), configuration.getLocalContextFactory(), sessionsFactory);
IdentifierFactory<String> idFactory = new AffinityIdentifierFactory<>(configuration.getIdentifierFactory(), cache, this.configuration.getKeyAffinityServiceFactory());
Batcher<TransactionBatch> batcher = new InfinispanBatcher(cache);
return new InfinispanSSOManager<>(factory, idFactory, batcher);
}
use of org.wildfly.clustering.ee.infinispan.InfinispanCacheProperties in project wildfly by wildfly.
the class InfinispanSessionManagerFactory method createSessionManager.
@Override
public <L> SessionManager<L, TransactionBatch> createSessionManager(final SessionManagerConfiguration<L> configuration) {
final Batcher<TransactionBatch> batcher = new InfinispanBatcher(this.config.getCache());
final Cache<Key<String>, ?> cache = this.config.getCache();
final CacheProperties properties = new InfinispanCacheProperties(cache.getCacheConfiguration());
final IdentifierFactory<String> factory = new AffinityIdentifierFactory<>(configuration.getIdentifierFactory(), cache, this.config.getKeyAffinityServiceFactory());
final CommandDispatcherFactory dispatcherFactory = this.config.getCommandDispatcherFactory();
final NodeFactory<Address> nodeFactory = this.config.getNodeFactory();
final int maxActiveSessions = this.config.getSessionManagerFactoryConfiguration().getMaxActiveSessions();
InfinispanSessionManagerConfiguration config = new InfinispanSessionManagerConfiguration() {
@Override
public SessionExpirationListener getExpirationListener() {
return configuration.getExpirationListener();
}
@Override
public ServletContext getServletContext() {
return configuration.getServletContext();
}
@Override
public Cache<Key<String>, ?> getCache() {
return cache;
}
@Override
public CacheProperties getProperties() {
return properties;
}
@Override
public IdentifierFactory<String> getIdentifierFactory() {
return factory;
}
@Override
public Batcher<TransactionBatch> getBatcher() {
return batcher;
}
@Override
public CommandDispatcherFactory getCommandDispatcherFactory() {
return dispatcherFactory;
}
@Override
public NodeFactory<Address> getNodeFactory() {
return nodeFactory;
}
@Override
public int getMaxActiveSessions() {
return maxActiveSessions;
}
@Override
public Recordable<ImmutableSession> getInactiveSessionRecorder() {
return configuration.getInactiveSessionRecorder();
}
};
return new InfinispanSessionManager<>(this.createSessionFactory(properties, configuration.getLocalContextFactory()), config);
}
use of org.wildfly.clustering.ee.infinispan.InfinispanCacheProperties in project wildfly by wildfly.
the class InfinispanBeanManagerFactory method createBeanManager.
@Override
public BeanManager<I, T, TransactionBatch> createBeanManager(Supplier<I> identifierFactory, PassivationListener<T> passivationListener, RemoveListener<T> removeListener) {
ByteBufferMarshaller marshaller = new JBossByteBufferMarshaller(this.configuration.getMarshallingConfigurationRepository(), this.configuration.getBeanConfiguration().getModule().getClassLoader());
MarshalledValueFactory<ByteBufferMarshaller> factory = new ByteBufferMarshalledValueFactory(marshaller);
Cache<BeanKey<I>, BeanEntry<I>> beanCache = this.configuration.getCache();
Cache<BeanGroupKey<I>, BeanGroupEntry<I, T, ByteBufferMarshaller>> groupCache = this.configuration.getCache();
CacheProperties properties = new InfinispanCacheProperties(groupCache.getCacheConfiguration());
String beanName = this.configuration.getBeanConfiguration().getName();
BeanPassivationConfiguration passivationConfig = this.configuration.getPassivationConfiguration();
PassivationConfiguration<T> passivation = new PassivationConfiguration<T>() {
@Override
public PassivationListener<T> getPassivationListener() {
return passivationListener;
}
@Override
public BeanPassivationConfiguration getConfiguration() {
return passivationConfig;
}
};
Predicate<Map.Entry<? super BeanKey<I>, ? super BeanEntry<I>>> beanFilter = new BeanFilter<>(beanName);
BeanGroupFactory<I, T, ByteBufferMarshaller> groupFactory = new InfinispanBeanGroupFactory<>(groupCache, beanCache, beanFilter, factory, properties, passivation);
Configuration<BeanGroupKey<I>, BeanGroupEntry<I, T, ByteBufferMarshaller>, BeanGroupFactory<I, T, ByteBufferMarshaller>> groupConfiguration = new SimpleConfiguration<>(groupCache, groupFactory);
BeanFactory<I, T> beanFactory = new InfinispanBeanFactory<>(beanName, groupFactory, beanCache, properties, this.configuration.getBeanConfiguration().getTimeout(), properties.isPersistent() ? passivationListener : null);
Configuration<BeanKey<I>, BeanEntry<I>, BeanFactory<I, T>> beanConfiguration = new SimpleConfiguration<>(beanCache, beanFactory);
Group<Address> group = this.configuration.getGroup();
KeyAffinityServiceFactory affinityFactory = this.configuration.getKeyAffinityServiceFactory();
CommandDispatcherFactory dispatcherFactory = this.configuration.getCommandDispatcherFactory();
Duration timeout = this.configuration.getBeanConfiguration().getTimeout();
ExpirationConfiguration<T> expiration = new ExpirationConfiguration<T>() {
@Override
public Duration getTimeout() {
return timeout;
}
@Override
public RemoveListener<T> getRemoveListener() {
return removeListener;
}
};
String name = this.configuration.getName();
InfinispanBeanManagerConfiguration<I, T> configuration = new InfinispanBeanManagerConfiguration<I, T>() {
@Override
public String getName() {
return name;
}
@Override
public Predicate<Map.Entry<? super BeanKey<I>, ? super BeanEntry<I>>> getBeanFilter() {
return beanFilter;
}
@Override
public KeyAffinityServiceFactory getAffinityFactory() {
return affinityFactory;
}
@Override
public Group<Address> getGroup() {
return group;
}
@Override
public CommandDispatcherFactory getCommandDispatcherFactory() {
return dispatcherFactory;
}
@Override
public ExpirationConfiguration<T> getExpirationConfiguration() {
return expiration;
}
@Override
public PassivationConfiguration<T> getPassivationConfiguration() {
return passivation;
}
@Override
public CacheProperties getProperties() {
return properties;
}
};
return new InfinispanBeanManager<>(configuration, identifierFactory, beanConfiguration, groupConfiguration);
}
Aggregations