Package org.apache.openejb.util

Examples of org.apache.openejb.util.Duration


    public Duration getStartupTimeout() {
        return startupTimeout;
    }

    public ActiveMQResourceAdapterBuilder withStartupTimeout(final long time, final TimeUnit unit) {
        return withStartupTimeout(new Duration(time, unit));
    }
View Full Code Here


    public ActiveMQResourceAdapterBuilder withStartupTimeout(final long time, final TimeUnit unit) {
        return withStartupTimeout(new Duration(time, unit));
    }

    public void setStartupTimeout(final long time, final TimeUnit unit) {
        setStartupTimeout(new Duration(time, unit));
    }
View Full Code Here

        port = options.get("port", port);
        initialServers = options.get("initialServers", initialServers);
        heartRate = options.get("heart_rate", heartRate);
        discoveryHost = options.get("discoveryHost", host);
        name = name != null ? name : options.get("discoveryName", MultipointServer.randomColor());
        reconnectDelay = options.get("reconnectDelay", new Duration("30 seconds"));

        final Set<URI> uris = new LinkedHashSet<URI>();

        // Connect the initial set of peer servers
        final StringTokenizer st = new StringTokenizer(initialServers, ",");
View Full Code Here

    private final Timer timer;
    private final List<Deployments> deployments = new ArrayList<Deployments>();

    public AutoDeployer(final ConfigurationFactory factory, final List<Deployments> deployments) {
        final Options options = SystemInstance.get().getOptions();
        final Duration interval = options.get("openejb.autodeploy.interval", new Duration(2, TimeUnit.SECONDS));

        if (interval.getUnit() == null) {
            interval.setUnit(TimeUnit.SECONDS);
        }

        this.factory = factory;
        this.deployments.addAll(deployments);
        this.pollIntervalMillis = interval.getUnit().toMillis(interval.getTime());
        this.timer = new Timer(this.getClass().getSimpleName(), true);
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    public void deploy(final BeanContext beanContext) throws OpenEJBException {
        final Options options = new Options(beanContext.getProperties());

        final Duration accessTimeout = getDuration(
            options,
            "AccessTimeout",
            getDuration(options, "Timeout", this.accessTimeout, TimeUnit.MILLISECONDS), // default timeout
            TimeUnit.MILLISECONDS
        );
        final Duration closeTimeout = getDuration(options, "CloseTimeout", this.closeTimeout, TimeUnit.MINUTES);

        final ObjectRecipe recipe = PassthroughFactory.recipe(new Pool.Builder(poolBuilder));
        recipe.allow(Option.CASE_INSENSITIVE_FACTORY);
        recipe.allow(Option.CASE_INSENSITIVE_PROPERTIES);
        recipe.allow(Option.IGNORE_MISSING_PROPERTIES);
View Full Code Here

        }
    }

    private Duration getDuration(final Options options, final String property, final Duration defaultValue, final TimeUnit defaultUnit) {
        final String s = options.get(property, defaultValue.toString());
        final Duration duration = new Duration(s);
        if (duration.getUnit() == null) {
            duration.setUnit(defaultUnit);
        }
        return duration;
    }
View Full Code Here

            .size(options.get("AsynchronousPool.Size", 5))
            .threadFactory(new DaemonThreadFactory("@Asynchronous", appContext.getId()));

        return new AsynchronousPool(
            builder.build(options),
            options.get("AsynchronousPool.ShutdownWaitDuration", new Duration(1, TimeUnit.MINUTES)));
    }
View Full Code Here

    protected final Cache<Object, Instance> cache;
    private final ConcurrentHashMap<Object, Instance> checkedOutInstances = new ConcurrentHashMap<Object, Instance>();
    private final SessionContext sessionContext;

    public ManagedContainer(final Object id, final SecurityService securityService) throws SystemException {
        this.cache = new SimpleCache<Object, Instance>(null, new SimplePassivater(), 1000, 50, new Duration("1 hour"));
        this.containerID = id;
        this.securityService = securityService;
        cache.setListener(new StatefulCacheListener());
        sessionContext = new ManagedContext(securityService, new ManagedUserTransaction(new EjbUserTransaction(), entityManagerRegistry));
    }
View Full Code Here

                             final Instance instance,
                             final ThreadContext callContext,
                             final InterfaceType callType) throws OpenEJBException {
        final BeanContext beanContext = callContext.getBeanContext();

        final Duration accessTimeout = getAccessTimeout(beanContext, runMethod);
        final boolean read = javax.ejb.LockType.READ.equals(beanContext.getConcurrencyAttribute(runMethod));

        final Lock lock = aquireLock(read, accessTimeout, instance, runMethod);

        Object returnValue;
View Full Code Here

        return returnValue;
    }

    private Duration getAccessTimeout(final BeanContext beanContext, final Method callMethod) {
        Duration accessTimeout = beanContext.getAccessTimeout(callMethod);
        if (accessTimeout == null) {
            accessTimeout = beanContext.getAccessTimeout();
            if (accessTimeout == null) {
                accessTimeout = this.accessTimeout;
            }
View Full Code Here

TOP

Related Classes of org.apache.openejb.util.Duration

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.