You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by sy...@apache.org on 2005/10/18 11:32:30 UTC
svn commit: r326062 - in /cocoon: blocks/cron/trunk/WEB-INF/xconf/
blocks/ojb/trunk/java/org/apache/cocoon/ojb/components/
blocks/portal/trunk/java/org/apache/cocoon/portal/impl/
trunk/src/java/org/apache/cocoon/components/ trunk/src/java/org/apache/co...
Author: sylvain
Date: Tue Oct 18 02:31:53 2005
New Revision: 326062
URL: http://svn.apache.org/viewcvs?rev=326062&view=rev
Log:
Add Preloadable for those cases where Startable's method have no meaning, restore Startable on RunnableManager
Added:
cocoon/trunk/src/java/org/apache/cocoon/components/Preloadable.java (with props)
Modified:
cocoon/blocks/cron/trunk/WEB-INF/xconf/cocoon-cron.xconf
cocoon/blocks/ojb/trunk/java/org/apache/cocoon/ojb/components/ConnectionFactoryImpl.java
cocoon/blocks/ojb/trunk/java/org/apache/cocoon/ojb/components/LoggerImpl.java
cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/AbstractComponent.java
cocoon/trunk/src/java/org/apache/cocoon/components/thread/DefaultRunnableManager.java
cocoon/trunk/src/java/org/apache/cocoon/core/container/CoreServiceManager.java
cocoon/trunk/src/java/org/apache/cocoon/core/container/DefaultServiceSelector.java
cocoon/trunk/src/java/org/apache/cocoon/core/container/StandaloneServiceSelector.java
cocoon/trunk/src/test/org/apache/cocoon/components/thread/DefaultRunnableManagerTestCase.java
Modified: cocoon/blocks/cron/trunk/WEB-INF/xconf/cocoon-cron.xconf
URL: http://svn.apache.org/viewcvs/cocoon/blocks/cron/trunk/WEB-INF/xconf/cocoon-cron.xconf?rev=326062&r1=326061&r2=326062&view=diff
==============================================================================
--- cocoon/blocks/cron/trunk/WEB-INF/xconf/cocoon-cron.xconf (original)
+++ cocoon/blocks/cron/trunk/WEB-INF/xconf/cocoon-cron.xconf Tue Oct 18 02:31:53 2005
@@ -22,7 +22,7 @@
<components>
<component role="org.apache.cocoon.components.cron.JobScheduler"
class="org.apache.cocoon.components.cron.CocoonQuartzJobScheduler"
- logger="cron" preload="true">
+ logger="cron">
<!--+
| Definitions for a thread pool used to schedule jobs
+-->
Modified: cocoon/blocks/ojb/trunk/java/org/apache/cocoon/ojb/components/ConnectionFactoryImpl.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/ojb/trunk/java/org/apache/cocoon/ojb/components/ConnectionFactoryImpl.java?rev=326062&r1=326061&r2=326062&view=diff
==============================================================================
--- cocoon/blocks/ojb/trunk/java/org/apache/cocoon/ojb/components/ConnectionFactoryImpl.java (original)
+++ cocoon/blocks/ojb/trunk/java/org/apache/cocoon/ojb/components/ConnectionFactoryImpl.java Tue Oct 18 02:31:53 2005
@@ -15,24 +15,23 @@
*/
package org.apache.cocoon.ojb.components;
+import java.sql.Connection;
+import java.sql.SQLException;
+
import org.apache.avalon.excalibur.datasource.DataSourceComponent;
import org.apache.avalon.framework.CascadingRuntimeException;
import org.apache.avalon.framework.activity.Disposable;
-import org.apache.avalon.framework.activity.Startable;
import org.apache.avalon.framework.component.Component;
import org.apache.avalon.framework.service.ServiceException;
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.avalon.framework.service.ServiceSelector;
import org.apache.avalon.framework.service.Serviceable;
import org.apache.avalon.framework.thread.ThreadSafe;
-
+import org.apache.cocoon.components.Preloadable;
import org.apache.ojb.broker.accesslayer.ConnectionFactory;
import org.apache.ojb.broker.accesslayer.LookupException;
import org.apache.ojb.broker.metadata.JdbcConnectionDescriptor;
-import java.sql.Connection;
-import java.sql.SQLException;
-
/**
* OJB ConnectionFactory implemenation to bridge into the Avalon DataSource
* connection pooling component defined in the Cocoon configuration.
@@ -58,7 +57,9 @@
* @version $Id$
*/
public class ConnectionFactoryImpl implements Component, ThreadSafe, Serviceable, Disposable,
- ConnectionFactory, Startable {
+ ConnectionFactory, Preloadable {
+
+ // Preloadable to ensure that static attributes are properly setup at startup.
/** The <code>ServiceManager</code> to be used */
private static ServiceManager manager;
@@ -149,21 +150,5 @@
public void releaseAllResources() {
// Nothing to do here
- }
-
- /**
- * Implementation of <code>Startable</code> so that Cocoon-OJB integration
- * works in lazy-loading mode.
- */
- public void start() throws Exception {
- // nothing
- }
-
- /**
- * Implementation of <code>Startable</code> so that Cocoon-OJB integration
- * works in lazy-loading mode.
- */
- public void stop() throws Exception {
- // nothing
}
}
Modified: cocoon/blocks/ojb/trunk/java/org/apache/cocoon/ojb/components/LoggerImpl.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/ojb/trunk/java/org/apache/cocoon/ojb/components/LoggerImpl.java?rev=326062&r1=326061&r2=326062&view=diff
==============================================================================
--- cocoon/blocks/ojb/trunk/java/org/apache/cocoon/ojb/components/LoggerImpl.java (original)
+++ cocoon/blocks/ojb/trunk/java/org/apache/cocoon/ojb/components/LoggerImpl.java Tue Oct 18 02:31:53 2005
@@ -16,12 +16,11 @@
package org.apache.cocoon.ojb.components;
import org.apache.avalon.framework.activity.Initializable;
-import org.apache.avalon.framework.activity.Startable;
import org.apache.avalon.framework.component.Component;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.framework.logger.NullLogger;
import org.apache.avalon.framework.thread.ThreadSafe;
-
+import org.apache.cocoon.components.Preloadable;
import org.apache.ojb.broker.util.configuration.Configuration;
import org.apache.ojb.broker.util.configuration.ConfigurationException;
import org.apache.ojb.broker.util.logging.Logger;
@@ -51,7 +50,9 @@
*/
public class LoggerImpl extends AbstractLogEnabled
implements Component, ThreadSafe, Initializable,
- Logger, Startable {
+ Logger, Preloadable {
+
+ // Preloadable to ensure that static attributes are properly setup at startup.
/**
* Root logger for all OJB loggers
@@ -262,21 +263,5 @@
}
return "null";
- }
-
- /**
- * Implementation of <code>Startable</code> so that Cocoon-OJB integration
- * works in lazy-loading mode.
- */
- public void start() throws Exception {
- // nothing
- }
-
- /**
- * Implementation of <code>Startable</code> so that Cocoon-OJB integration
- * works in lazy-loading mode.
- */
- public void stop() throws Exception {
- // nothing
}
}
Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/AbstractComponent.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/AbstractComponent.java?rev=326062&r1=326061&r2=326062&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/AbstractComponent.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/AbstractComponent.java Tue Oct 18 02:31:53 2005
@@ -17,7 +17,6 @@
import org.apache.avalon.framework.activity.Disposable;
import org.apache.avalon.framework.activity.Initializable;
-import org.apache.avalon.framework.activity.Startable;
import org.apache.avalon.framework.context.Context;
import org.apache.avalon.framework.context.ContextException;
import org.apache.avalon.framework.context.Contextualizable;
@@ -26,6 +25,7 @@
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.avalon.framework.service.Serviceable;
import org.apache.avalon.framework.thread.ThreadSafe;
+import org.apache.cocoon.components.Preloadable;
import org.apache.cocoon.portal.PortalService;
import org.apache.cocoon.portal.event.Receiver;
@@ -42,7 +42,9 @@
*/
public class AbstractComponent
extends AbstractLogEnabled
- implements Contextualizable, Serviceable, Disposable, ThreadSafe, Initializable, Startable {
+ implements Contextualizable, Serviceable, Disposable, ThreadSafe, Initializable, Preloadable {
+
+ // Implement Preloadable so that it automatically subscribes to events.
/** The service manager. */
protected ServiceManager manager;
@@ -88,20 +90,5 @@
if ( this instanceof Receiver ) {
this.portalService.getComponentManager().getEventManager().subscribe((Receiver)this);
}
- }
-
- /**
- * This component is startable as it is a possible receiver for event notifications.
- * @see org.apache.avalon.framework.activity.Startable#start()
- */
- public void start() throws Exception {
- // nothing to do
- }
-
- /**
- * @see org.apache.avalon.framework.activity.Startable#stop()
- */
- public void stop() throws Exception {
- // nothing to do
}
}
Added: cocoon/trunk/src/java/org/apache/cocoon/components/Preloadable.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/components/Preloadable.java?rev=326062&view=auto
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/components/Preloadable.java (added)
+++ cocoon/trunk/src/java/org/apache/cocoon/components/Preloadable.java Tue Oct 18 02:31:53 2005
@@ -0,0 +1,36 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * 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.apache.cocoon.components;
+
+/**
+ * Marker interface for Avalon-managed components that need to be loaded at startup time.
+ * <p>
+ * Components implementing this interface will always be initialized when the service manager that
+ * holds them is created, even if lazy-loading of components is enabled.
+ * <p>
+ * Note that there are also other ways to require a component to be loaded at startup:
+ * <ul>
+ * <li>by implementing the <code>Startable</code> Avalon interface, which defines two additional
+ * <code>start()</code> and <code>stop()</code> methods</li>
+ * <li>by adding the <code>preload="true"</code> attribute on a component's configuration</li>
+ * </ul>
+ *
+ * @since 2.2
+ * @version $Id$
+ */
+public interface Preloadable {
+ // nothing, it's just a marker
+}
Propchange: cocoon/trunk/src/java/org/apache/cocoon/components/Preloadable.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/trunk/src/java/org/apache/cocoon/components/Preloadable.java
------------------------------------------------------------------------------
svn:keywords = Id
Modified: cocoon/trunk/src/java/org/apache/cocoon/components/thread/DefaultRunnableManager.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/components/thread/DefaultRunnableManager.java?rev=326062&r1=326061&r2=326062&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/components/thread/DefaultRunnableManager.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/components/thread/DefaultRunnableManager.java Tue Oct 18 02:31:53 2005
@@ -22,7 +22,7 @@
import java.util.TreeSet;
import org.apache.avalon.framework.activity.Disposable;
-import org.apache.avalon.framework.activity.Initializable;
+import org.apache.avalon.framework.activity.Startable;
import org.apache.avalon.framework.configuration.Configurable;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
@@ -71,13 +71,10 @@
implements RunnableManager,
Configurable,
Disposable,
+ Startable,
Runnable,
- Initializable,
ThreadSafe {
- // Note: this class doesn't need to be Startable. This allows the thread pool to be
- // lazily created the first time a Runnable is executed.
-
//~ Static fields/initializers ---------------------------------------------
/** The default {@link ThreadFactory} */
@@ -251,8 +248,6 @@
* @see org.apache.avalon.framework.activity.Disposable#dispose()
*/
public void dispose() {
- doStop();
-
if( getLogger().isDebugEnabled() ) {
getLogger().debug( "Disposing all thread pools" );
}
@@ -458,19 +453,10 @@
/**
* Start the managing thread
- *
- * @throws Exception
- */
- public void initialize() throws Exception {
- doStart();
- }
-
- /**
- * Start the managing thread
*
* @throws Exception DOCUMENT ME!
*/
- private void doStart() throws Exception {
+ public void start() throws Exception {
if( getLogger().isDebugEnabled() ) {
getLogger().debug( "Starting the heart" );
}
@@ -482,7 +468,7 @@
/**
* Stop the managing thread
*/
- private void doStop( ) {
+ public void stop( ) {
keepRunning = false;
synchronized( commandStack ) {
Modified: cocoon/trunk/src/java/org/apache/cocoon/core/container/CoreServiceManager.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/core/container/CoreServiceManager.java?rev=326062&r1=326061&r2=326062&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/core/container/CoreServiceManager.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/core/container/CoreServiceManager.java Tue Oct 18 02:31:53 2005
@@ -43,6 +43,7 @@
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.avalon.framework.thread.ThreadSafe;
import org.apache.cocoon.components.ComponentInfo;
+import org.apache.cocoon.components.Preloadable;
import org.apache.cocoon.configuration.ConfigurationBuilder;
import org.apache.cocoon.core.Core;
import org.apache.cocoon.core.CoreResourceNotFoundException;
@@ -609,13 +610,17 @@
final ComponentInfo baseInfo)
throws Exception {
- boolean lazyLoad = this.settings.isLazyMode();
- if (lazyLoad) {
- // handle restrictions to lazy loading
- if (role.endsWith("Selector") || configuration.getAttributeAsBoolean("preload", false)) {
- lazyLoad = false;
- } else {
- // Check if the class implements Startable
+ boolean lazyLoad;
+
+ if (configuration.getAttribute("preload", null) != null) {
+ // This one has precedence
+ lazyLoad = configuration.getAttributeAsBoolean("preload");
+
+ } else {
+ lazyLoad = this.settings.isLazyMode();
+
+ if (lazyLoad) {
+ // Check if the class implements Startable or Preloadable
Class componentClass;
try {
componentClass = componentEnv.loadClass(className);
@@ -623,7 +628,8 @@
throw new Exception("Cannot find class " + className + " for component at " +
configuration.getLocation(), cnfe);
}
- if (Startable.class.isAssignableFrom(componentClass)) {
+ if (Startable.class.isAssignableFrom(componentClass) ||
+ Preloadable.class.isAssignableFrom(componentClass)) {
lazyLoad = false;
}
}
Modified: cocoon/trunk/src/java/org/apache/cocoon/core/container/DefaultServiceSelector.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/core/container/DefaultServiceSelector.java?rev=326062&r1=326061&r2=326062&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/core/container/DefaultServiceSelector.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/core/container/DefaultServiceSelector.java Tue Oct 18 02:31:53 2005
@@ -27,6 +27,7 @@
import org.apache.avalon.framework.service.Serviceable;
import org.apache.avalon.framework.thread.ThreadSafe;
import org.apache.cocoon.components.ComponentInfo;
+import org.apache.cocoon.components.Preloadable;
/**
* Default component selector for Cocoon's components. This selector "flattens" its declaration
@@ -37,7 +38,7 @@
* @version $Id$
* @since 2.2
*/
-public class DefaultServiceSelector extends AbstractLogEnabled implements ThreadSafe, Serviceable, Configurable, ServiceSelector {
+public class DefaultServiceSelector extends AbstractLogEnabled implements ThreadSafe, Preloadable, Serviceable, Configurable, ServiceSelector {
/** Synthetic hint to alias the default component */
public static final String DEFAULT_HINT = "$default$";
Modified: cocoon/trunk/src/java/org/apache/cocoon/core/container/StandaloneServiceSelector.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/core/container/StandaloneServiceSelector.java?rev=326062&r1=326061&r2=326062&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/core/container/StandaloneServiceSelector.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/core/container/StandaloneServiceSelector.java Tue Oct 18 02:31:53 2005
@@ -29,6 +29,7 @@
import org.apache.avalon.framework.service.ServiceSelector;
import org.apache.avalon.framework.service.Serviceable;
import org.apache.cocoon.components.ComponentInfo;
+import org.apache.cocoon.components.Preloadable;
import org.apache.cocoon.core.container.handler.ComponentHandler;
/**
@@ -39,7 +40,7 @@
*/
public class StandaloneServiceSelector
extends AbstractServiceManager
-implements ServiceSelector, Serviceable, Configurable {
+implements Preloadable, ServiceSelector, Serviceable, Configurable {
/** The application context for components
*/
Modified: cocoon/trunk/src/test/org/apache/cocoon/components/thread/DefaultRunnableManagerTestCase.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/test/org/apache/cocoon/components/thread/DefaultRunnableManagerTestCase.java?rev=326062&r1=326061&r2=326062&view=diff
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/components/thread/DefaultRunnableManagerTestCase.java (original)
+++ cocoon/trunk/src/test/org/apache/cocoon/components/thread/DefaultRunnableManagerTestCase.java Tue Oct 18 02:31:53 2005
@@ -35,7 +35,8 @@
*
* @param name
*/
- public DefaultRunnableManagerTestCase( String name ) {
+ public DefaultRunnableManagerTestCase( String name )
+ {
super( name );
}
@@ -47,7 +48,8 @@
* @throws Exception DOCUMENT ME!
*/
public final void testConfigureDaemonPool( )
- throws Exception {
+ throws Exception
+ {
final MockControl threadPoolConfigControl =
createStrictControl( Configuration.class );
final Configuration threadPoolConfig =
@@ -137,25 +139,24 @@
new DefaultRunnableManager( );
runnableManager.enableLogging( logger );
- try {
+ try
+ {
runnableManager.configure( mainConfig );
- } catch( final ConfigurationException ce ) {
- assertTrue( "Throw unexpected ConfigurationException", false );
}
- try {
- runnableManager.initialize();
- } catch ( final Exception e ) {
- assertTrue( "Throw unexpected Exception in initialize.", false);
+ catch( final ConfigurationException ce )
+ {
+ assertTrue( "Throw unexpected ConfigurationException", false );
}
- runnableManager.dispose();
- verify();
+ runnableManager.dispose( );
+ verify( );
}
/**
* DOCUMENT ME!
*/
- public final void testConfigureMinimal() {
+ public final void testConfigureMinimal( )
+ {
final MockControl mainConfigControl =
createStrictControl( Configuration.class );
final Configuration mainConfig =
@@ -166,13 +167,13 @@
mainConfigControl.expectAndReturn( mainConfig.getChild( "thread-pools" ),
createChildrenConfigMock( "thread-pool",
new Configuration[ 0 ] ) );
- mainConfigControl.replay();
+ mainConfigControl.replay( );
final MockControl childLoggerDefaultControl =
createStrictControl( Logger.class );
final Logger childLoggerDefault =
(Logger)childLoggerDefaultControl.getMock( );
- childLoggerDefaultControl.replay();
+ childLoggerDefaultControl.replay( );
final MockControl loggerControl = createStrictControl( Logger.class );
final Logger logger = (Logger)loggerControl.getMock( );
@@ -192,19 +193,17 @@
new DefaultRunnableManager( );
runnableManager.enableLogging( logger );
- try {
+ try
+ {
runnableManager.configure( mainConfig );
- } catch( final ConfigurationException ce ) {
- assertTrue( "Throw unexpected ConfigurationException", false );
}
- try {
- runnableManager.initialize();
- } catch ( final Exception e ) {
- assertTrue( "Throw unexpected Exception in initialize.", false);
+ catch( final ConfigurationException ce )
+ {
+ assertTrue( "Throw unexpected ConfigurationException", false );
}
- runnableManager.dispose();
- verify();
+ runnableManager.dispose( );
+ verify( );
}
/**
@@ -213,7 +212,8 @@
* @throws Exception DOCUMENT ME!
*/
public final void testConfigureMyPool( )
- throws Exception {
+ throws Exception
+ {
final MockControl threadPoolConfigControl =
createStrictControl( Configuration.class );
final Configuration threadPoolConfig =
@@ -262,7 +262,7 @@
{
threadPoolConfig
} ) );
- mainConfigControl.replay();
+ mainConfigControl.replay( );
final MockControl childLoggerDefaultControl =
createStrictControl( Logger.class );
@@ -302,15 +302,13 @@
new DefaultRunnableManager( );
runnableManager.enableLogging( logger );
- try {
+ try
+ {
runnableManager.configure( mainConfig );
- } catch( final ConfigurationException ce ) {
- assertTrue( "Throw unexpected ConfigurationException", false );
}
- try {
- runnableManager.initialize();
- } catch ( final Exception e ) {
- assertTrue( "Throw unexpected Exception in initialize.", false);
+ catch( final ConfigurationException ce )
+ {
+ assertTrue( "Throw unexpected ConfigurationException", false );
}
runnableManager.dispose( );
@@ -321,7 +319,8 @@
* Class under test for void createPool(String, int, int, int, int,
* boolean, long, String, boolean, int)
*/
- public final void testCreatePoolStringintintintintbooleanlongStringbooleanint() {
+ public final void testCreatePoolStringintintintintbooleanlongStringbooleanint( )
+ {
final MockControl mainConfigControl =
createStrictControl( Configuration.class );
final Configuration mainConfig =
@@ -380,11 +379,6 @@
{
assertTrue( "Throw unexpected ConfigurationException", false );
}
- try {
- runnableManager.initialize();
- } catch ( final Exception e ) {
- assertTrue( "Throw unexpected Exception in initialize.", false);
- }
runnableManager.createPool( "mypool", 230, 15, 12, Thread.MIN_PRIORITY,
false, 15500, "DISCARD", false, 22200 );
@@ -460,11 +454,6 @@
{
assertTrue( "Throw unexpected ConfigurationException", false );
}
- try {
- runnableManager.initialize();
- } catch ( final Exception e ) {
- assertTrue( "Throw unexpected Exception in initialize.", false);
- }
final ThreadPool threadPool =
runnableManager.createPool( 200, 5, 2, Thread.MAX_PRIORITY, true,
@@ -540,18 +529,14 @@
new DefaultRunnableManager( );
runnableManager.enableLogging( logger );
- try {
+ try
+ {
runnableManager.configure( mainConfig );
}
catch( final ConfigurationException ce )
{
assertTrue( "Throw unexpected ConfigurationException", false );
}
- try {
- runnableManager.initialize();
- } catch ( final Exception e ) {
- assertTrue( "Throw unexpected Exception in initialize.", false);
- }
final MockControl runnableControl =
createStrictControl( Runnable.class );
@@ -561,11 +546,13 @@
try
{
+ runnableManager.start( );
Thread.yield( );
Thread.sleep( 20 );
runnableManager.execute( runnable );
Thread.yield( );
Thread.sleep( 20 );
+ runnableManager.stop( );
Thread.yield( );
Thread.sleep( 20 );
runnableManager.dispose( );
@@ -647,11 +634,6 @@
{
assertTrue( "Throw unexpected ConfigurationException", false );
}
- try {
- runnableManager.initialize();
- } catch ( final Exception e ) {
- assertTrue( "Throw unexpected Exception in initialize.", false);
- }
final MockControl runnableControl =
createStrictControl( Runnable.class );
@@ -661,11 +643,13 @@
try
{
+ runnableManager.start( );
Thread.yield( );
Thread.sleep( 20 );
runnableManager.execute( runnable, 100, 0 );
Thread.yield( );
Thread.sleep( 200 );
+ runnableManager.stop( );
Thread.yield( );
Thread.sleep( 20 );
runnableManager.dispose( );
@@ -745,11 +729,6 @@
{
assertTrue( "Throw unexpected ConfigurationException", false );
}
- try {
- runnableManager.initialize();
- } catch ( final Exception e ) {
- assertTrue( "Throw unexpected Exception in initialize.", false);
- }
final MockControl runnableControl =
createStrictControl( Runnable.class );
@@ -760,11 +739,13 @@
try
{
+ runnableManager.start( );
Thread.yield( );
Thread.sleep( 20 );
runnableManager.execute( runnable, 100, 100 );
Thread.yield( );
Thread.sleep( 200 );
+ runnableManager.stop( );
Thread.yield( );
Thread.sleep( 20 );
runnableManager.dispose( );
@@ -863,11 +844,6 @@
{
assertTrue( "Throw unexpected ConfigurationException", false );
}
- try {
- runnableManager.initialize();
- } catch ( final Exception e ) {
- assertTrue( "Throw unexpected Exception in initialize.", false);
- }
final MockControl runnableControl =
createStrictControl( Runnable.class );
@@ -877,6 +853,7 @@
try
{
+ runnableManager.start( );
Thread.yield( );
Thread.sleep( 20 );
runnableManager.createPool( "mypool", 230, 15, 12,
@@ -885,6 +862,7 @@
runnableManager.execute( "mypool", runnable );
Thread.yield( );
Thread.sleep( 20 );
+ runnableManager.stop( );
Thread.yield( );
Thread.sleep( 20 );
runnableManager.dispose( );
@@ -983,11 +961,6 @@
{
assertTrue( "Throw unexpected ConfigurationException", false );
}
- try {
- runnableManager.initialize();
- } catch ( final Exception e ) {
- assertTrue( "Throw unexpected Exception in initialize.", false);
- }
final MockControl runnableControl =
createStrictControl( Runnable.class );
@@ -997,6 +970,7 @@
try
{
+ runnableManager.start( );
Thread.yield( );
Thread.sleep( 20 );
runnableManager.createPool( "mypool", 230, 15, 12,
@@ -1005,6 +979,7 @@
runnableManager.execute( "mypool", runnable, 100, 0 );
Thread.yield( );
Thread.sleep( 200 );
+ runnableManager.stop( );
Thread.yield( );
Thread.sleep( 20 );
runnableManager.dispose( );
@@ -1101,11 +1076,6 @@
{
assertTrue( "Throw unexpected ConfigurationException", false );
}
- try {
- runnableManager.initialize();
- } catch ( final Exception e ) {
- assertTrue( "Throw unexpected Exception in initialize.", false);
- }
final MockControl runnableControl =
createStrictControl( Runnable.class );
@@ -1115,6 +1085,7 @@
try
{
+ runnableManager.start( );
Thread.yield( );
Thread.sleep( 20 );
runnableManager.createPool( "mypool", 230, 15, 12,
@@ -1123,6 +1094,7 @@
runnableManager.execute( "mypool", runnable, 100, 100 );
Thread.yield( );
Thread.sleep( 200 );
+ runnableManager.stop( );
Thread.yield( );
Thread.sleep( 20 );
runnableManager.dispose( );