You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hivemind.apache.org by jc...@apache.org on 2005/03/28 03:31:53 UTC
cvs commit: jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/servicemodel PooledServiceModel.java
jcarman 2005/03/27 17:31:53
Modified: framework/src/java/org/apache/hivemind/impl/servicemodel
PooledServiceModel.java
Added: framework/src/test/org/apache/hivemind/impl/servicemodel
TestPooledServiceModel.java
PooledShutdownListenerService.xml
Log:
Core service implementations which implement RegistryShutdownListener are not notified for primitive, singleton, and pooled service models
PR: HIVEMIND-103
Revision Changes Path
1.1 jakarta-hivemind/framework/src/test/org/apache/hivemind/impl/servicemodel/TestPooledServiceModel.java
Index: TestPooledServiceModel.java
===================================================================
// Copyright 2004, 2005 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.hivemind.impl.servicemodel;
import org.apache.hivemind.Registry;
import org.apache.hivemind.test.HiveMindTestCase;
/**
* @author James Carman
* @version 1.0
*/
public class TestPooledServiceModel extends HiveMindTestCase
{
public void testRegistryShutdownCalled() throws Exception
{
Registry registry = buildFrameworkRegistry( "PooledShutdownListenerService.xml" );
Simple simple = ( Simple )registry.getService( Simple.class );
BooleanHolder holder = new BooleanHolder();
holder.setValue( false );
simple.setHolder( holder );
registry.shutdown();
assertTrue( holder.getValue() );
}
}
1.1 jakarta-hivemind/framework/src/test/org/apache/hivemind/impl/servicemodel/PooledShutdownListenerService.xml
Index: PooledShutdownListenerService.xml
===================================================================
<?xml version="1.0"?>
<!--
Copyright 2004, 2005 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.
-->
<module id="hivemind.lib.test" version="1.0.0">
<service-point id="simple" interface="org.apache.hivemind.impl.servicemodel.Simple">
<invoke-factory model="pooled">
<construct class="org.apache.hivemind.impl.servicemodel.SimpleImpl" />
</invoke-factory>
</service-point>
</module>
1.13 +4 -1 jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/servicemodel/PooledServiceModel.java
Index: PooledServiceModel.java
===================================================================
RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/servicemodel/PooledServiceModel.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- PooledServiceModel.java 19 Feb 2005 02:40:54 -0000 1.12
+++ PooledServiceModel.java 28 Mar 2005 01:31:53 -0000 1.13
@@ -226,7 +226,10 @@
if (!_serviceInterface.isInstance(core))
core = constructBridgeProxy(core);
-
+ if( core instanceof RegistryShutdownListener )
+ {
+ getServicePoint().getShutdownCoordinator().addRegistryShutdownListener( ( RegistryShutdownListener )core );
+ }
return new PooledService(core);
}
catch (Exception ex)
---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-cvs-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-cvs-help@jakarta.apache.org