Package org.apache.openejb.util

Examples of org.apache.openejb.util.Duration


        }
       
        for (Map.Entry<Method, MethodAttributeInfo> entry : attributes.entrySet()) {
            MethodConcurrencyInfo value = (MethodConcurrencyInfo) entry.getValue();
            MethodContext methodContext = beanContext.getMethodContext(entry.getKey());
            Duration accessTimeout = new Duration(value.accessTimeout.time, TimeUnit.valueOf(value.accessTimeout.unit));
            methodContext.setAccessTimeout(accessTimeout);
        }
    }
View Full Code Here


    }

    public void deploy(BeanContext beanContext) throws OpenEJBException {
        Options options = new Options(beanContext.getProperties());

        Duration accessTimeout = getDuration(options, "Timeout", this.accessTimeout, TimeUnit.MILLISECONDS);
        accessTimeout = getDuration(options, "AccessTimeout", accessTimeout, TimeUnit.MILLISECONDS);
        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

        if (duration.getUnit() == null) duration.setUnit(unit);
    }

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

        // ejbTimeout
        deployment.setEjbTimeout(getTimeout(ejbClass, bean.timeoutMethod));

        if (bean.statefulTimeout != null) {
            deployment.setStatefulTimeout(new Duration(bean.statefulTimeout.time, TimeUnit.valueOf(bean.statefulTimeout.unit)));
        }

        if (bean instanceof StatefulBeanInfo) {
            StatefulBeanInfo statefulBeanInfo = (StatefulBeanInfo) bean;
View Full Code Here

    }

    public void deploy(CoreDeploymentInfo deploymentInfo) throws OpenEJBException {
        Options options = new Options(deploymentInfo.getProperties());

        Duration accessTimeout = getDuration(options, "Timeout", this.accessTimeout, Duration.Unit.milliseconds);
        accessTimeout = getDuration(options, "AccessTimeout", accessTimeout, Duration.Unit.milliseconds);
        Duration closeTimeout = getDuration(options, "CloseTimeout", this.closeTimeout, Duration.Unit.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

        if (duration.getUnit() == null) convert(duration, unit);
    }

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

    /**
     * Always assumes the duration.getUnit() is null implying that
     * the duration.getTime() should be treated as the specified unit.
     */
    private void convert(Duration duration, Duration.Unit unit) {
        Duration converted = new Duration(duration.getTime() + " " + unit);
        duration.setTime(converted.getTime());
        duration.setUnit(converted.getUnit());
    }
View Full Code Here

        MBeanServer server = ManagementFactory.getPlatformMBeanServer();

        Pool.Builder builder = new Pool.Builder();
        builder.setMinSize(4);
        builder.setIdleTimeout(new Duration("30 seconds"));
        builder.setSweepInterval(new Duration("15 seconds"));
        builder.setMaxAge(new Duration("2 minutes"));
        builder.setSupplier(new Pool.Supplier(){
            public void discard(Object o, Pool.Event reason) {
            }

            public Object create() {
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(Object id, 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

        }
       
        for (Map.Entry<Method, MethodAttributeInfo> entry : attributes.entrySet()) {
            MethodConcurrencyInfo value = (MethodConcurrencyInfo) entry.getValue();
            MethodContext methodContext = beanContext.getMethodContext(entry.getKey());
            Duration accessTimeout = new Duration(value.accessTimeout.time, TimeUnit.valueOf(value.accessTimeout.unit));
            methodContext.setAccessTimeout(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.