Skip to content

Commit

Permalink
Revert "FURNACE-34: Upgrade to Weld 3.0.0.Alpha8"
Browse files Browse the repository at this point in the history
This reverts commit 5fa5c66.
  • Loading branch information
gastaldi committed Apr 24, 2015
1 parent e665db0 commit 29e6e66
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* JBoss, Home of Professional Open Source
* Copyright 2013, Red Hat, Inc., and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.forge.furnace.container.cdi.impl;

import org.jboss.weld.bootstrap.spi.BootstrapConfiguration;

/**
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
*/
public class PerformanceTunedBootstrapConfiguration implements BootstrapConfiguration
{
public PerformanceTunedBootstrapConfiguration()
{
// TODO detect # of CPUs and #of classes to scan. optimize pools respectively
}

@Override
public boolean isConcurrentDeploymentEnabled()
{
return false;
}

@Override
public int getPreloaderThreadPoolSize()
{
return 0;
// return Math.max(1, Runtime.getRuntime().availableProcessors() - 1);
}

@Override
public void cleanup()
{
}

@Override
public boolean isNonPortableModeEnabled()
{
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public void start(Addon addon) throws Exception
ContainerServiceExtension serviceExtension = new ContainerServiceExtension(container, addon);
ContainerBeanRegistrant registrantExtension = new ContainerBeanRegistrant();

weld = new ModularWeld(addon.getId().getName(), scanResult);
weld = new ModularWeld(scanResult);
weld.addExtension(serviceExtension);
weld.addExtension(registrantExtension);
WeldContainer container = weld.initialize();
Expand All @@ -95,8 +95,7 @@ public void start(Addon addon) throws Exception

ServiceRegistryProducer serviceRegistryProducer = BeanManagerUtils.getContextualInstance(manager,
ServiceRegistryProducer.class);
serviceRegistry = new WeldServiceRegistry(furnace.getLockManager(), addon, manager,
serviceExtension.getServices());
serviceRegistry = new WeldServiceRegistry(furnace.getLockManager(), addon, manager, serviceExtension.getServices());
serviceRegistryProducer.setServiceRegistry(serviceRegistry);
Assert.notNull(BeanManagerUtils.getContextualInstance(manager, ServiceRegistry.class),
"InboundEvent registry was null.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.util.Collection;
import java.util.List;

import org.jboss.weld.environment.se.discovery.url.ClasspathScanningException;
import org.jboss.weld.resources.spi.ResourceLoader;

/**
Expand Down Expand Up @@ -87,7 +88,7 @@ public ModuleScanResult scan()
}
catch (UnsupportedEncodingException ex)
{
throw new RuntimeException("Error decoding URL using UTF-8");
throw new ClasspathScanningException("Error decoding URL using UTF-8");
}

paths.add(urlPath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
*/
package org.jboss.forge.furnace.container.cdi.weld;

import org.jboss.forge.furnace.container.cdi.impl.PerformanceTunedBootstrapConfiguration;
import org.jboss.weld.bootstrap.api.CDI11Bootstrap;
import org.jboss.weld.bootstrap.api.SingletonProvider;
import org.jboss.weld.bootstrap.api.helpers.TCCLSingletonProvider;
import org.jboss.weld.bootstrap.spi.BootstrapConfiguration;
import org.jboss.weld.bootstrap.spi.Deployment;
import org.jboss.weld.environment.se.Weld;
import org.jboss.weld.resources.spi.ResourceLoader;
Expand All @@ -16,20 +20,26 @@
*/
public class ModularWeld extends Weld
{
static
{
/*
* This must happen once per JVM
*/
SingletonProvider.initialize(new TCCLSingletonProvider());
}

private final ModuleScanResult scanResult;

public ModularWeld(String containerId, ModuleScanResult scanResult)
public ModularWeld(ModuleScanResult scanResult)
{
super(containerId);
this.scanResult = scanResult;
property("org.jboss.weld.bootstrap.preloaderThreadPoolSize", 0);
property("org.jboss.weld.bootstrap.concurrentDeployment", false);
}

@Override
protected Deployment createDeployment(ResourceLoader loader, CDI11Bootstrap bootstrap)
{
Deployment deployment = super.createDeployment(scanResult.getResourceLoader(), bootstrap);
deployment.getServices().add(BootstrapConfiguration.class, new PerformanceTunedBootstrapConfiguration());
return deployment;
}
}
5 changes: 3 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,12 @@
<forge.scm.url>http://github.com/forge/furnace-cdi</forge.scm.url>
<!-- This version is bound to the Weld version -->
<version.annotations>1.0.0.Alpha1</version.annotations>
<version.cdi>1.2</version.cdi>
<version.cdi>1.1</version.cdi>
<version.furnace>${project.version}</version.furnace>
<version.javax.el>2.2.4</version.javax.el>
<version.jboss.spec>3.0.2.Final</version.jboss.spec>
<version.slf4j>1.7.2</version.slf4j>
<version.weld>3.0.0.Alpha8</version.weld>
<version.weld>2.2.1.Final</version.weld>
<version.junit>4.11</version.junit>
</properties>

Expand Down

0 comments on commit 29e6e66

Please sign in to comment.