Package org.wildfly.clustering.ejb

Examples of org.wildfly.clustering.ejb.Time


        return this.deploymentUnitServiceName;
    }

    @Override
    public Time getTimeout() {
        return (this.statefulTimeout != null) ? new Time(this.statefulTimeout.getValue(), this.statefulTimeout.getTimeUnit()) : null;
    }
View Full Code Here


        this.expiration = expiration;
    }

    @Override
    public void schedule(I id) {
        Time timeout = this.expiration.getTimeout();
        long value = timeout.getValue();
        if (value >= 0) {
            TimeUnit unit = timeout.getUnit();
            InfinispanEjbLogger.ROOT_LOGGER.tracef("Scheduling stateful session bean %s to expire in %d %s", id, value, unit);
            Runnable task = new ExpirationTask(id);
            // Make sure the expiration future map insertion happens before map removal (during task execution).
            synchronized (task) {
                this.expirationFutures.put(id, this.expiration.getExecutor().schedule(task, value, unit));
View Full Code Here

        Configuration<I, BeanKey<I>, BeanEntry<G>, BeanFactory<G, I, T>> beanConfiguration = new SimpleConfiguration<>(beanCache, beanFactory, beanIdentifierFactory);
        final NodeFactory<Address> nodeFactory = this.nodeFactory.getValue();
        final Registry<String, ?> registry = this.registry.getValue();
        final KeyAffinityServiceFactory affinityFactory = this.affinityFactory.getValue();
        final CommandDispatcherFactory dispatcherFactory = this.dispatcherFactory.getValue();
        final Time timeout = this.context.getTimeout();
        final ScheduledExecutorService scheduler = this.scheduler.getValue();
        final ExpirationConfiguration<T> expiration = new ExpirationConfiguration<T>() {
            @Override
            public Time getTimeout() {
                return timeout;
View Full Code Here

    public void start() {
        for (KeyAffinityService<?> service: this.affinityServices) {
            service.start();
        }
        final List<Scheduler<I>> schedulers = new ArrayList<>(2);
        Time timeout = this.expiration.getTimeout();
        if ((timeout != null) && (timeout.getValue() >= 0)) {
            schedulers.add(new BeanExpirationScheduler<>(this.batcher, new ExpiredBeanRemover<>(this.beanFactory), this.expiration));
        }
        if (this.passivation.isEvictionAllowed()) {
            schedulers.add(new BeanEvictionScheduler<>(this.beanName + ".eviction", this.batcher, this.beanFactory, this.dispatcherFactory, this.passivation));
        }
View Full Code Here

        String beanId = "immortal";

        when(config.getExecutor()).thenReturn(Executors.newSingleThreadScheduledExecutor());

        // Fun fact: the EJB specification allows a timeout value of 0, so only negative timeouts are treated as immortal
        when(config.getTimeout()).thenReturn(new Time(-1, TimeUnit.SECONDS));
        when(config.getRemoveListener()).thenReturn(listener);

        try (Scheduler<String> scheduler = new BeanExpirationScheduler<>(batcher, remover, config)) {
            scheduler.schedule(beanId);
View Full Code Here

        String beanId = "expiring";

        when(config.getExecutor()).thenReturn(Executors.newSingleThreadScheduledExecutor());
        when(batcher.createBatch()).thenReturn(batch);

        when(config.getTimeout()).thenReturn(new Time(1, TimeUnit.MILLISECONDS));
        when(config.getRemoveListener()).thenReturn(listener);
       
        try (Scheduler<String> scheduler = new BeanExpirationScheduler<>(batcher, remover, config)) {
            scheduler.schedule(beanId);
View Full Code Here

        RemoveListener<Object> listener = mock(RemoveListener.class);
        String beanId = "canceled";

        when(config.getExecutor()).thenReturn(Executors.newSingleThreadScheduledExecutor());

        when(config.getTimeout()).thenReturn(new Time(1, TimeUnit.MINUTES));
        when(config.getRemoveListener()).thenReturn(listener);
       
        try (Scheduler<String> scheduler = new BeanExpirationScheduler<>(batcher, remover, config)) {
            scheduler.schedule(beanId);
View Full Code Here

TOP

Related Classes of org.wildfly.clustering.ejb.Time

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.