geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Blevins <david.blev...@visi.com>
Subject Re: Singletons in Geronimo
Date Wed, 28 Oct 2009 22:13:01 GMT

On Oct 28, 2009, at 10:12 AM, Quintin Beukes wrote:

> Hey,
>
> Busy compiling. WIll let you know how the new changes work.
>
> So, what's the basic idea behind these changes? I had a quick look at
> the patches. Though I don't know enough about Geronimo and would need
> to carefully step through the code to understand the change.

About the simplest way I can think to describe it is that the startup  
process was like this:

1. start EjbModuleGBean -- OpenEJB creates CoreDeploymentInfo objects  
and deploys them into the containers.
2. start EjbDeploymentGBean -- Grabs the CoreDeploymentInfo, finishes  
JNDI setup, installs itself into the CoreDeploymentInfo.

The problem is that "deploys them into containers" can involve JNDI  
lookups and those require step 2 to have completed.  Previously the  
only beans that could actually get the chance to do a lookup on  
"container.deploy()" was MDBs and that was bascially because the  
MdbContainer would hook the bean up to the JMS Resource Adapter and  
messages could start flowing in immediately -- even before we reached  
step 2.  So the workaround that was added (not by me) was to put that  
synchronized block in so that lookups would wait till step 2  
completed.  That works fine for MDBs as they all get processed in  
other threads so those "incoming message" threads would just hold for  
a moment while we continued to start the app.  With Singletons you get  
a deadlock for very obvious reasons; a lookup in step 1 will cause the  
startup thread to wait for itself to complete step 2.  Obviously that  
will never happen.

So I basically reworked the code so that 2 happens before 1 and  
removed that synchronized block.  I more or less worked around the  
fact that EjbDeploymentGBean needs a reference to the not yet created  
CoreDeploymentInfo object by using a java.util.concurrent.Future  
object and some smarter code in the GeronimoThreadContextListener.  So  
the initialization we were doing in step 2 now happens on the fly the  
first time the bean is invoked, whenever that is.

Hope that makes any kind of sense :)

-David


>
> Quintin Beukes
>
>
>
> On Wed, Oct 28, 2009 at 3:17 PM, David Blevins  
> <david.blevins@visi.com> wrote:
>>
>> On Oct 28, 2009, at 12:02 AM, David Jencks wrote:
>>
>>> Did you build all of geronimo?  I wonder if this is caused by  
>>> something
>>> like trying to run a plugin packaged under java6 on java5, which  
>>> doesn't
>>> always work.
>>
>> Right, built from the root with an 'rm -r
>> ~/.m2/repository/org/apache/geronimo' for good measure.
>>
>>> will try a build here overnight...
>>
>> Great.  Nice to have a second pair of eyes.
>>
>> -David
>>
>>
>>> On Oct 27, 2009, at 10:06 PM, David Blevins wrote:
>>>
>>>> The changes look good, though I seem to be running into an issue  
>>>> creating
>>>> the car for the wadi stuff.  Not sure what might be happening and  
>>>> looking
>>>> for ideas.
>>>>
>>>> Here's the -e output:
>>>>
>>>> [INFO] [car:package]
>>>> [INFO] Packaging module configuration:
>>>> /Users/dblevins/work/geronimo-22-branch/plugins/openejb/openejb- 
>>>> clustering-wadi/target/work/plan.xml
>>>> [INFO]  GBean references are not using proxies
>>>> [INFO]  ClassLoading behaviour has changed.  The Original  
>>>> Classloading
>>>> mode is in effect.  If you are experiencing a problem
>>>> you can change the behaviour by specifying
>>>> -DXorg.apache.geronimo.kernel.config.MPCLSearchOption= property.   
>>>> Specify
>>>> ="safe" to revert to the original behaviour.  This is a temporary  
>>>> change
>>>> until we decide whether or not to make it
>>>> permanent for the 2.0 release
>>>> [INFO] Started deployer:
>>>> org.apache.geronimo.framework/geronimo-gbean-deployer/2.2- 
>>>> SNAPSHOT/car
>>>> [INFO]  The Strict Manifest Classpath processing mode is in effect.
>>>> This option can be altered by specifying
>>>> -DXorg.apache.geronimo.deployment.LenientMFCP=true|false
>>>> Specify ="true" for more lenient processing such as ignoring  
>>>> missing jars
>>>> and references that are not spec compliant.
>>>> [INFO]
>>>> ------------------------------------------------------------------------
>>>> [ERROR] BUILD ERROR
>>>> [INFO]
>>>> ------------------------------------------------------------------------
>>>> [INFO] could not package plugin
>>>>
>>>> Embedded error: Unable to create configuration for deployment
>>>> [INFO]
>>>> ------------------------------------------------------------------------
>>>> [INFO] Trace
>>>> org.apache.maven.lifecycle.LifecycleExecutionException: could not  
>>>> package
>>>> plugin
>>>>        at
>>>> org 
>>>> .apache 
>>>> .maven 
>>>> .lifecycle 
>>>> .DefaultLifecycleExecutor 
>>>> .executeGoals(DefaultLifecycleExecutor.java:584)
>>>>        at
>>>> org 
>>>> .apache 
>>>> .maven 
>>>> .lifecycle 
>>>> .DefaultLifecycleExecutor 
>>>> .executeGoalWithLifecycle(DefaultLifecycleExecutor.java:500)
>>>>        at
>>>> org 
>>>> .apache 
>>>> .maven 
>>>> .lifecycle 
>>>> .DefaultLifecycleExecutor 
>>>> .executeGoal(DefaultLifecycleExecutor.java:479)
>>>>        at
>>>> org 
>>>> .apache 
>>>> .maven 
>>>> .lifecycle 
>>>> .DefaultLifecycleExecutor 
>>>> .executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:331)
>>>>        at
>>>> org 
>>>> .apache 
>>>> .maven 
>>>> .lifecycle 
>>>> .DefaultLifecycleExecutor 
>>>> .executeTaskSegments(DefaultLifecycleExecutor.java:292)
>>>>        at
>>>> org 
>>>> .apache 
>>>> .maven 
>>>> .lifecycle 
>>>> .DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java: 
>>>> 142)
>>>>        at  
>>>> org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
>>>>        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java: 
>>>> 129)
>>>>        at org.apache.maven.cli.MavenCli.main(MavenCli.java:301)
>>>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native  
>>>> Method)
>>>>        at
>>>> sun 
>>>> .reflect 
>>>> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>        at
>>>> sun 
>>>> .reflect 
>>>> .DelegatingMethodAccessorImpl 
>>>> .invoke(DelegatingMethodAccessorImpl.java:25)
>>>>        at java.lang.reflect.Method.invoke(Method.java:592)
>>>>        at
>>>> org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
>>>>        at org.codehaus.classworlds.Launcher.launch(Launcher.java: 
>>>> 255)
>>>>        at
>>>> org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java: 
>>>> 430)
>>>>        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
>>>> Caused by: org.apache.maven.plugin.MojoExecutionException: could  
>>>> not
>>>> package plugin
>>>>        at
>>>> org 
>>>> .apache 
>>>> .geronimo.mavenplugins.car.PackageMojo.execute(PackageMojo.java: 
>>>> 212)
>>>>        at
>>>> org 
>>>> .apache 
>>>> .maven 
>>>> .plugin 
>>>> .DefaultPluginManager.executeMojo(DefaultPluginManager.java:453)
>>>>        at
>>>> org 
>>>> .apache 
>>>> .maven 
>>>> .lifecycle 
>>>> .DefaultLifecycleExecutor 
>>>> .executeGoals(DefaultLifecycleExecutor.java:559)
>>>>        ... 16 more
>>>> Caused by: org.apache.geronimo.common.DeploymentException: Unable  
>>>> to
>>>> create configuration for deployment
>>>>        at
>>>> org 
>>>> .apache 
>>>> .geronimo 
>>>> .deployment 
>>>> .DeploymentContext.createTempConfiguration(DeploymentContext.java: 
>>>> 151)
>>>>        at
>>>> org 
>>>> .apache 
>>>> .geronimo 
>>>> .deployment.DeploymentContext.<init>(DeploymentContext.java:131)
>>>>        at
>>>> org 
>>>> .apache 
>>>> .geronimo 
>>>> .deployment.DeploymentContext.<init>(DeploymentContext.java:111)
>>>>        at
>>>> org 
>>>> .apache 
>>>> .geronimo 
>>>> .deployment 
>>>> .service 
>>>> .ServiceConfigBuilder 
>>>> .buildConfiguration(ServiceConfigBuilder.java:227)
>>>>        at
>>>> org 
>>>> .apache 
>>>> .geronimo 
>>>> .deployment 
>>>> .service 
>>>> .ServiceConfigBuilder 
>>>> .buildConfiguration(ServiceConfigBuilder.java:199)
>>>>        at
>>>> org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:257)
>>>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native  
>>>> Method)
>>>>        at
>>>> sun 
>>>> .reflect 
>>>> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>        at
>>>> sun 
>>>> .reflect 
>>>> .DelegatingMethodAccessorImpl 
>>>> .invoke(DelegatingMethodAccessorImpl.java:25)
>>>>        at java.lang.reflect.Method.invoke(Method.java:592)
>>>>        at
>>>> org 
>>>> .apache 
>>>> .geronimo 
>>>> .gbean 
>>>> .runtime 
>>>> .ReflectionMethodInvoker.invoke(ReflectionMethodInvoker.java:34)
>>>>        at
>>>> org 
>>>> .apache 
>>>> .geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java: 
>>>> 130)
>>>>        at
>>>> org 
>>>> .apache 
>>>> .geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java: 
>>>> 850)
>>>>        at
>>>> org 
>>>> .apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java: 
>>>> 237)
>>>>        at
>>>> org 
>>>> .apache 
>>>> .geronimo 
>>>> .mavenplugins.car.PackageMojo.invokeDeployer(PackageMojo.java:483)
>>>>        at
>>>> org 
>>>> .apache 
>>>> .geronimo 
>>>> .mavenplugins.car.PackageMojo.buildPackage(PackageMojo.java:309)
>>>>        at
>>>> org 
>>>> .apache 
>>>> .geronimo.mavenplugins.car.PackageMojo.execute(PackageMojo.java: 
>>>> 209)
>>>>        ... 18 more
>>>> Caused by: org.apache.geronimo.kernel.config.LifecycleException:  
>>>> load of
>>>> org.apache.geronimo.configs/openejb-clustering-wadi/2.2-SNAPSHOT/ 
>>>> car failed
>>>>        at
>>>> org 
>>>> .apache 
>>>> .geronimo 
>>>> .kernel 
>>>> .config 
>>>> .SimpleConfigurationManager 
>>>> .loadConfiguration(SimpleConfigurationManager.java:316)
>>>>        at
>>>> org 
>>>> .apache 
>>>> .geronimo 
>>>> .deployment 
>>>> .DeploymentConfigurationManager 
>>>> .loadConfiguration(DeploymentConfigurationManager.java:115)
>>>>        at
>>>> org 
>>>> .apache 
>>>> .geronimo 
>>>> .kernel 
>>>> .config 
>>>> .SimpleConfigurationManager 
>>>> .loadConfiguration(SimpleConfigurationManager.java:277)
>>>>        at
>>>> org 
>>>> .apache 
>>>> .geronimo 
>>>> .deployment 
>>>> .DeploymentConfigurationManager 
>>>> .loadConfiguration(DeploymentConfigurationManager.java:111)
>>>>        at
>>>> org 
>>>> .apache 
>>>> .geronimo 
>>>> .deployment 
>>>> .DeploymentContext.createTempConfiguration(DeploymentContext.java: 
>>>> 148)
>>>>        ... 34 more
>>>> Caused by:  
>>>> org.apache.geronimo.kernel.config.InvalidConfigException:
>>>> Error starting configuration gbean
>>>> org.apache.geronimo.configs/clustering/2.2-SNAPSHOT/car
>>>>        at
>>>> org 
>>>> .apache 
>>>> .geronimo 
>>>> .kernel 
>>>> .config 
>>>> .SimpleConfigurationManager.load(SimpleConfigurationManager.java: 
>>>> 341)
>>>>        at
>>>> org 
>>>> .apache 
>>>> .geronimo 
>>>> .deployment 
>>>> .DeploymentConfigurationManager 
>>>> .load(DeploymentConfigurationManager.java:119)
>>>>        at
>>>> org 
>>>> .apache 
>>>> .geronimo 
>>>> .kernel 
>>>> .config 
>>>> .SimpleConfigurationManager 
>>>> .loadConfiguration(SimpleConfigurationManager.java:302)
>>>>        ... 38 more
>>>> Caused by:  
>>>> org.apache.geronimo.kernel.config.InvalidConfigException:
>>>> Unable to deserialize GBeanState in classloader:
>>>> [org.apache.geronimo.kernel.config.MultiParentClassLoader
>>>> id=org.apache.geronimo.configs/clustering/2.2-SNAPSHOT/car]
>>>>        at
>>>> org 
>>>> .apache 
>>>> .geronimo 
>>>> .kernel 
>>>> .config.SerializedGBeanState.loadGBeans(SerializedGBeanState.java: 
>>>> 137)
>>>>        at
>>>> org 
>>>> .apache 
>>>> .geronimo 
>>>> .kernel 
>>>> .config.SerializedGBeanState.getGBeans(SerializedGBeanState.java: 
>>>> 64)
>>>>        at
>>>> org 
>>>> .apache 
>>>> .geronimo 
>>>> .kernel.config.ConfigurationData.getGBeans(ConfigurationData.java: 
>>>> 177)
>>>>        at
>>>> org 
>>>> .apache 
>>>> .geronimo.kernel.config.Configuration.<init>(Configuration.java: 
>>>> 295)
>>>>        at
>>>> org 
>>>> .apache 
>>>> .geronimo 
>>>> .kernel 
>>>> .config 
>>>> .SimpleConfigurationManager.load(SimpleConfigurationManager.java: 
>>>> 337)
>>>>        ... 40 more
>>>> Caused by: java.lang.NullPointerException
>>>>        at
>>>> org.apache.geronimo.gbean.GBeanData.setAttribute(GBeanData.java: 
>>>> 148)
>>>>        at
>>>> org.apache.geronimo.gbean.GBeanData 
>>>> $V0Externalizable.readExternal(GBeanData.java:336)
>>>>        at
>>>> org.apache.geronimo.gbean.GBeanData.readExternal(GBeanData.java: 
>>>> 282)
>>>>        at
>>>> org 
>>>> .apache 
>>>> .geronimo 
>>>> .kernel 
>>>> .config.SerializedGBeanState.loadGBeans(SerializedGBeanState.java: 
>>>> 124)
>>>>        ... 44 more
>>>> [INFO]
>>>> ------------------------------------------------------------------------
>>>> [INFO] Total time: 1 minute 14 seconds
>>>> [INFO] Finished at: Tue Oct 27 22:02:24 PDT 2009
>>>> [INFO] Final Memory: 58M/104M
>>>> [INFO]
>>>> ------------------------------------------------------------------------
>>>>
>>>
>>>
>>
>>
>


Mime
View raw message