Package org.apache.openejb.util

Examples of org.apache.openejb.util.Duration


    public SingletonContainerBuilder withAccessTimeout(final long time, final TimeUnit unit) {
        return withAccessTimeout(new Duration(time, unit));
    }

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


    public Duration getAccessTimeout() {
        return accessTimeout;
    }

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

    public StatefulContainerBuilder withAccessTimeout(final long time, final TimeUnit unit) {
        return withAccessTimeout(new Duration(time, unit));
    }

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

    public Duration getTimeOut() {
        return timeOut;
    }

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

    public StatefulContainerBuilder withTimeOut(final long time, final TimeUnit unit) {
        return withTimeOut(new Duration(time, unit));
    }

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

    private String toMillis(final String d) {
        if (d == null) {
            return null;
        }
        return Long.toString(new Duration(d).getTime(TimeUnit.MILLISECONDS));
    }
View Full Code Here

        final String cipher = properties.getProperty("PasswordCipher");
        if (cipher == null || "PlainText".equals(cipher)) { // no need to warn
            properties.remove("PasswordCipher");
        }
        if (properties.containsKey("TimeBetweenEvictionRuns")) {
            properties.setProperty("idleConnectionTestPeriodInSeconds", Long.toString(new Duration((String) properties.remove("TimeBetweenEvictionRuns")).getTime(TimeUnit.SECONDS)));
        }
        if (properties.containsKey("UserName")) {
            properties.put("username", properties.remove("UserName"));
        }
        if (properties.containsKey("MaxActive")) {
View Full Code Here

    private final ConcurrentMap<Object, Instance> checkedOutInstances = new ConcurrentHashMap<Object, Instance>();
    private final SessionContext sessionContext;
    private final boolean preventExtendedEntityManagerSerialization;

    public StatefulContainer(final Object id, final SecurityService securityService, final Cache<Object, Instance> cache) {
        this(id, securityService, cache, new Duration(-1, TimeUnit.MILLISECONDS), true, new DefaultLockFactory());
    }
View Full Code Here

                // remember instance until it is returned to the cache               
                checkedOutInstances.put(primaryKey, instance);
            }
        }

        final Duration accessTimeout = getAccessTimeout(instance.beanContext, callMethod);

        final LockFactory.StatefulLock currLock = instance.getLock();
        final boolean lockAcquired;
        if (accessTimeout == null || accessTimeout.getTime() < 0) {
            // wait indefinitely for a lock
            currLock.lock();
            lockAcquired = true;
        } else if (accessTimeout.getTime() == 0) {
            // concurrent calls are not allowed, lock only once
            lockAcquired = currLock.tryLock();
        } else {
            // try to get a lock within the specified period.
            try {
                lockAcquired = currLock.tryLock(accessTimeout.getTime(), accessTimeout.getUnit());
            } catch (final InterruptedException e) {
                throw new ApplicationException("Unable to get lock.", e);
            }
        }
        // Did we acquire the lock to the current execution?
View Full Code Here

    }

    private Duration getAccessTimeout(final BeanContext beanContext, Method callMethod) {
        callMethod = beanContext.getMatchingBeanMethod(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.