use of org.wildfly.clustering.infinispan.spi.distribution.SimpleLocality in project wildfly by wildfly.
the class InfinispanBeanManager method start.
@Override
public void start() {
this.executor = Executors.newSingleThreadExecutor(createThreadFactory());
this.affinity.start();
Time timeout = this.expiration.getTimeout();
Scheduler<I> noopScheduler = new Scheduler<I>() {
@Override
public void schedule(I id) {
}
@Override
public void cancel(I id) {
}
@Override
public void cancel(Locality locality) {
}
@Override
public void close() {
}
};
Scheduler<I> beanScheduler = (timeout != null) && (timeout.getValue() >= 0) ? new BeanExpirationScheduler<>(this.batcher, new ExpiredBeanRemover<>(this.beanFactory), this.expiration) : noopScheduler;
Scheduler<I> groupScheduler = (this.passivation.getConfiguration().getMaxSize() >= 0) ? new BeanGroupEvictionScheduler<>(this.beanName + ".eviction", this.batcher, this.groupFactory, this.dispatcherFactory, this.passivation) : noopScheduler;
this.schedulerContext = new SchedulerContext<I>() {
@Override
public void close() {
groupScheduler.close();
beanScheduler.close();
}
@Override
public Scheduler<I> getBeanScheduler() {
return beanScheduler;
}
@Override
public Scheduler<I> getBeanGroupScheduler() {
return groupScheduler;
}
};
this.dispatcher = this.dispatcherFactory.createCommandDispatcher(this.beanName + ".schedulers", this.schedulerContext);
this.cache.addListener(this, this.filter, null);
this.schedule(new SimpleLocality(false), new ConsistentHashLocality(this.cache));
}
use of org.wildfly.clustering.infinispan.spi.distribution.SimpleLocality in project wildfly by wildfly.
the class InfinispanSessionManager method start.
@Override
public void start() {
this.executor = Executors.newSingleThreadExecutor(createThreadFactory());
if (this.recorder != null) {
this.recorder.reset();
}
this.identifierFactory.start();
final List<Scheduler> schedulers = new ArrayList<>(2);
schedulers.add(new SessionExpirationScheduler(this.batcher, new ExpiredSessionRemover<>(this.factory, this.expirationListener)));
if (this.maxActiveSessions >= 0) {
schedulers.add(new SessionEvictionScheduler(this.cache.getName() + ".eviction", this.factory, this.batcher, this.dispatcherFactory, this.maxActiveSessions));
}
this.scheduler = new Scheduler() {
@Override
public void schedule(String sessionId, ImmutableSessionMetaData metaData) {
schedulers.forEach(scheduler -> scheduler.schedule(sessionId, metaData));
}
@Override
public void cancel(String sessionId) {
schedulers.forEach(scheduler -> scheduler.cancel(sessionId));
}
@Override
public void cancel(Locality locality) {
schedulers.forEach(scheduler -> scheduler.cancel(locality));
}
@Override
public void close() {
schedulers.forEach(scheduler -> scheduler.close());
}
};
this.dispatcher = this.dispatcherFactory.createCommandDispatcher(this.cache.getName() + ".schedulers", this.scheduler);
this.cache.addListener(this, this.filter);
this.schedule(new SimpleLocality(false), this.locality);
}
Aggregations