Skip to Content.
Sympa Menu

notify-dpml - r940 - in trunk/main/transit/core/src: main/net/dpml/transit main/net/dpml/transit/model test/net/dpml/transit/test

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mcconnell at BerliOS <mcconnell AT mail.berlios.de>
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: r940 - in trunk/main/transit/core/src: main/net/dpml/transit main/net/dpml/transit/model test/net/dpml/transit/test
  • Date: Sat, 21 Jan 2006 23:47:27 +0100

Author: mcconnell
Date: 2006-01-21 23:47:26 +0100 (Sat, 21 Jan 2006)
New Revision: 940

Added:

trunk/main/transit/core/src/test/net/dpml/transit/test/DisposalTestCase.java
Modified:
trunk/main/transit/core/src/main/net/dpml/transit/DefaultTransitModel.java
trunk/main/transit/core/src/main/net/dpml/transit/Transit.java
trunk/main/transit/core/src/main/net/dpml/transit/model/TransitModel.java
Log:
fix disposal issue in transit

Modified:
trunk/main/transit/core/src/main/net/dpml/transit/DefaultTransitModel.java
===================================================================
---
trunk/main/transit/core/src/main/net/dpml/transit/DefaultTransitModel.java
2006-01-21 21:48:11 UTC (rev 939)
+++
trunk/main/transit/core/src/main/net/dpml/transit/DefaultTransitModel.java
2006-01-21 22:47:26 UTC (rev 940)
@@ -71,7 +71,7 @@
* @param logger the logging channel to assign to the model
* @return the transit model
*/
- public static TransitModel getSecureModel( Logger logger )
+ public static DefaultTransitModel getSecureModel( Logger logger )
{
try
{
@@ -91,11 +91,25 @@
* <tt>local:xml:dpml/transit/config</tt>. If the resource does not exist
a classic
* default scenario will be returned.
*
+ * @return the transit model
+ * @exception Exception if an error occurs during model construction
+ */
+ public static DefaultTransitModel getDefaultModel() throws Exception
+ {
+ LoggingAdapter adapter = new LoggingAdapter( "transit" );
+ return getDefaultModel( adapter );
+ }
+
+ /**
+ * Resolve the transit configuration using the default resource path
+ * <tt>local:xml:dpml/transit/config</tt>. If the resource does not exist
a classic
+ * default scenario will be returned.
+ *
* @param logger the logging channel
* @return the transit model
* @exception Exception if an error occurs during model construction
*/
- public static TransitModel getDefaultModel( Logger logger ) throws
Exception
+ public static DefaultTransitModel getDefaultModel( Logger logger )
throws Exception
{
String path = System.getProperty( PROFILE_KEY );
if( null != path )
@@ -201,7 +215,10 @@
public synchronized void dispose()
{
m_cache.dispose();
- m_proxy.dispose();
+ if( null != m_proxy )
+ {
+ m_proxy.dispose();
+ }
try
{
UnicastRemoteObject.unexportObject( m_cache, true );
@@ -210,14 +227,17 @@
{
getLogger().warn( "Remote error during disposal.", e );
}
- try
+ if( null != m_proxy )
{
- UnicastRemoteObject.unexportObject( m_proxy, true );
+ try
+ {
+ UnicastRemoteObject.unexportObject( m_proxy, true );
+ }
+ catch( RemoteException e )
+ {
+ getLogger().warn( "Remote error during disposal.", e );
+ }
}
- catch( RemoteException e )
- {
- getLogger().warn( "Remote error during disposal.", e );
- }
}

private DefaultProxyModel createProxyModel( final TransitDirective
directive )
@@ -259,13 +279,13 @@
}
}

- static TransitModel getBootstrapModel() throws Exception
+ static DefaultTransitModel getBootstrapModel() throws Exception
{
Logger logger = new LoggingAdapter( "transit" );
return getSecureModel( logger );
}

- static TransitModel getClassicModel( Logger logger ) throws Exception
+ static DefaultTransitModel getClassicModel( Logger logger ) throws
Exception
{
TransitDirective directive = TransitDirective.CLASSIC_PROFILE;
return new DefaultTransitModel( logger, directive );

Modified: trunk/main/transit/core/src/main/net/dpml/transit/Transit.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/transit/Transit.java
2006-01-21 21:48:11 UTC (rev 939)
+++ trunk/main/transit/core/src/main/net/dpml/transit/Transit.java
2006-01-21 22:47:26 UTC (rev 940)
@@ -293,7 +293,7 @@
throw new TransitException( error, e );
}
}
-
+
/**
* Return the current cache directory.
* @return the cache directory.

Modified:
trunk/main/transit/core/src/main/net/dpml/transit/model/TransitModel.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/transit/model/TransitModel.java
2006-01-21 21:48:11 UTC (rev 939)
+++ trunk/main/transit/core/src/main/net/dpml/transit/model/TransitModel.java
2006-01-21 22:47:26 UTC (rev 940)
@@ -44,5 +44,4 @@
* @exception RemoteException if a remote exception occurs
*/
CacheModel getCacheModel() throws RemoteException;
-
}

Added:
trunk/main/transit/core/src/test/net/dpml/transit/test/DisposalTestCase.java
===================================================================
---
trunk/main/transit/core/src/test/net/dpml/transit/test/DisposalTestCase.java
2006-01-21 21:48:11 UTC (rev 939)
+++
trunk/main/transit/core/src/test/net/dpml/transit/test/DisposalTestCase.java
2006-01-21 22:47:26 UTC (rev 940)
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2004 Niclas Hedhman.
+ * Copyright 2004 Stephen J. McConnell.
+ *
+ * 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 net.dpml.transit.test;
+
+import junit.framework.TestCase;
+
+import net.dpml.transit.DefaultTransitModel;
+import net.dpml.transit.Transit;
+import net.dpml.transit.model.TransitModel;
+
+/**
+ * Test execution of the disposal of the Transit model.
+ *
+ * @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
+ * @version $Id: OnlineTestCase.java 2926 2005-06-27 10:53:17Z
mcconnell AT dpml.net $
+ */
+public class DisposalTestCase extends TestCase
+{
+ private DefaultTransitModel m_model;
+
+ public void testTransitLifecycle() throws Exception
+ {
+ m_model = DefaultTransitModel.getDefaultModel();
+ Transit.getInstance( m_model );
+ m_model.dispose();
+ }
+}




  • r940 - in trunk/main/transit/core/src: main/net/dpml/transit main/net/dpml/transit/model test/net/dpml/transit/test, mcconnell at BerliOS, 01/21/2006

Archive powered by MHonArc 2.6.24.

Top of Page