[jboss-cvs] JBossAS SVN: r61044 - trunk/system/src/main/org/jboss/system/server/profileservice/repository.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Mar 2 04:13:54 EST 2007
Author: scott.stark at jboss.org
Date: 2007-03-02 04:13:54 -0500 (Fri, 02 Mar 2007)
New Revision: 61044
Modified:
trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractFileAttachmentsSerializer.java
trunk/system/src/main/org/jboss/system/server/profileservice/repository/JavaSerializationAttachmentsSerializer.java
trunk/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepository.java
trunk/system/src/main/org/jboss/system/server/profileservice/repository/TCLObjectInputStream.java
Log:
More debugging
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractFileAttachmentsSerializer.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractFileAttachmentsSerializer.java 2007-03-02 09:13:04 UTC (rev 61043)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractFileAttachmentsSerializer.java 2007-03-02 09:13:54 UTC (rev 61044)
@@ -23,9 +23,13 @@
import java.io.File;
import java.io.IOException;
+import java.io.NotSerializableException;
import java.util.Map;
+import java.util.Map.Entry;
+import org.jboss.deployers.spi.deployer.DeploymentUnit;
import org.jboss.deployers.spi.structure.DeploymentContext;
+import org.jboss.logging.Logger;
import org.jboss.profileservice.aop.TrackingAdvice;
import org.jboss.profileservice.spi.AttachmentsSerializer;
@@ -38,6 +42,7 @@
public abstract class AbstractFileAttachmentsSerializer
implements AttachmentsSerializer
{
+ private static final Logger log = Logger.getLogger(AbstractFileAttachmentsSerializer.class);
/** The deployment pre-processed attachments store dir */
private File attachmentsStoreDir;
@@ -50,7 +55,7 @@
this.attachmentsStoreDir = attachmentsStoreDir;
}
- public Map<String, Object> loadAttachments(DeploymentContext ctx, String deployerID, ClassLoader loader)
+ public Map<String, Object> loadAttachments(DeploymentUnit ctx, String deployerID, ClassLoader loader)
throws Exception
{
if( attachmentsStoreDir == null )
@@ -70,7 +75,7 @@
return loadAttachments(attachmentsStore, loader);
}
- public void saveAttachments(DeploymentContext ctx, String deployerID, ClassLoader loader)
+ public void saveAttachments(DeploymentUnit ctx, String deployerID, ClassLoader loader)
throws Exception
{
if( attachmentsStoreDir == null )
@@ -89,9 +94,27 @@
throw new IOException("Failed to create attachmentsParent: "+attachmentsParent.getAbsolutePath());
}
- Map<String, Object> attachments = TrackingAdvice.clearAttachmentsForTarget(ctx.getTransientAttachments());
+ Map<String, Object> attachments = TrackingAdvice.clearAttachmentsForTarget(ctx.getTransientManagedObjects());
if( attachments != null )
- saveAttachments(attachmentsStore, attachments, loader);
+ {
+ try
+ {
+ saveAttachments(attachmentsStore, attachments, loader);
+ }
+ catch(NotSerializableException e)
+ {
+ // Log what is in the attachments
+ StringBuilder tmp = new StringBuilder("Save failed with NSE, attachments contents: ");
+ for(Entry<String, Object> entry : attachments.entrySet())
+ {
+ tmp.append(entry.getKey());
+ tmp.append('=');
+ tmp.append(entry.getValue());
+ }
+ log.error(tmp.toString());
+ throw e;
+ }
+ }
}
protected abstract Map<String, Object> loadAttachments(File attachmentsStore, ClassLoader loader)
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/JavaSerializationAttachmentsSerializer.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/JavaSerializationAttachmentsSerializer.java 2007-03-02 09:13:04 UTC (rev 61043)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/JavaSerializationAttachmentsSerializer.java 2007-03-02 09:13:54 UTC (rev 61044)
@@ -24,6 +24,7 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
+import java.io.NotSerializableException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.lang.reflect.Method;
@@ -63,10 +64,20 @@
}
finally
{
- if( ois != null )
+ try
+ {
ois.close();
- if( fis != null )
+ }
+ catch(Exception igore)
+ {
+ }
+ try
+ {
fis.close();
+ }
+ catch(Exception igore)
+ {
+ }
}
return map;
}
@@ -86,9 +97,27 @@
}
FileOutputStream fos = new FileOutputStream(attachmentsStore);
ObjectOutputStream oos = new ObjectOutputStream(fos);
- oos.writeObject(map);
- oos.close();
- fos.close();
+ try
+ {
+ oos.writeObject(map);
+ }
+ finally
+ {
+ try
+ {
+ oos.close();
+ }
+ catch(Exception igore)
+ {
+ }
+ try
+ {
+ fos.close();
+ }
+ catch(Exception igore)
+ {
+ }
+ }
}
/** Use reflection to access a URL[] getURLs or URL[] getClasspath method so
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepository.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepository.java 2007-03-02 09:13:04 UTC (rev 61043)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepository.java 2007-03-02 09:13:54 UTC (rev 61044)
@@ -25,13 +25,10 @@
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
-import java.io.NotSerializableException;
import java.io.ObjectOutputStream;
import java.net.URI;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
-import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
@@ -41,7 +38,6 @@
import org.jboss.deployers.plugins.structure.AbstractDeploymentContext;
import org.jboss.deployers.spi.attachments.Attachments;
-import org.jboss.deployers.spi.management.ComponentType;
import org.jboss.deployers.spi.structure.DeploymentContext;
import org.jboss.logging.Logger;
import org.jboss.profileservice.spi.AttachmentsSerializer;
@@ -62,8 +58,7 @@
* + root/{name}/deployers - profile deployers
* + root/{name}/deploy - installed deployments
* + root/{name}/apps - post install deployments
- * + root/{name}/profile/ctxs - pre-processed
- * + root/{name}/profile/edits - admin edits to deployments
+ * + root/{name}/attachments - pre-processed attachments + admin edits to deployments
*
* @author Scott.Stark at jboss.org
* @version $Revision$
@@ -269,7 +264,6 @@
// Make sure we don't return null
if( ctx == null )
throw new NoSuchDeploymentException("name="+name+", phase="+phase);
- loadAttachments(ctx);
return ctx;
}
@@ -464,7 +458,6 @@
DeploymentContext ctx = bootstrapCtxs.get(vfsPath);
if( ctx == null )
throw new NoSuchDeploymentException(vfsPath);
- this.loadAttachments(ctx);
return ctx;
}
@@ -472,10 +465,6 @@
throws Exception
{
Collection<DeploymentContext> ctxs = bootstrapCtxs.values();
- for(DeploymentContext ctx : ctxs)
- {
- this.loadAttachments(ctx);
- }
return ctxs;
}
@@ -498,7 +487,6 @@
DeploymentContext ctx = deployerCtxs.get(vfsPath);
if( ctx == null )
throw new NoSuchDeploymentException(vfsPath);
- this.loadAttachments(ctx);
return ctx;
}
@@ -506,10 +494,6 @@
throws Exception
{
Collection<DeploymentContext> ctxs = deployerCtxs.values();
- for(DeploymentContext ctx : ctxs)
- {
- this.loadAttachments(ctx);
- }
return ctxs;
}
@@ -519,7 +503,6 @@
DeploymentContext ctx = applicationCtxs.get(vfsPath);
if( ctx == null )
throw new NoSuchDeploymentException(vfsPath);
- this.loadAttachments(ctx);
return ctx;
}
@@ -527,17 +510,6 @@
throws Exception
{
Collection<DeploymentContext> ctxs = applicationCtxs.values();
- for(DeploymentContext ctx : ctxs)
- {
- try
- {
- this.loadAttachments(ctx);
- }
- catch(Exception e)
- {
- log.error("Failed to load attachments, ignoring"+e);
- }
- }
return ctxs;
}
@@ -575,28 +547,6 @@
applicationDir = new File(uri);
}
- private void loadAttachments(DeploymentContext ctx)
- throws Exception
- {
- ClassLoader prevTCL = Thread.currentThread().getContextClassLoader();
- try
- {
- Map<String, Object> map = null;
- if( map != null )
- {
- for(String key : map.keySet())
- {
- Object value = map.get(key);
- ctx.getPredeterminedManagedObjects().addAttachment(key, value);
- }
- }
- }
- finally
- {
- Thread.currentThread().setContextClassLoader(prevTCL);
- }
- }
-
/**
* Load the bootstrap descriptors under bootstrapDir:
*
@@ -666,7 +616,7 @@
// Check for a persisted context
// Load the base deployment
DeploymentContext deployment = new AbstractDeploymentContext(file);
- // Load any attachments
+ log.debug("Created deployment: "+deployment+", tmo="+deployment.getTransientManagedObjects());
return deployment;
}
Property changes on: trunk/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepository.java
___________________________________________________________________
Name: svn:keywords
- Id, Revision
+ Id Revision
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/TCLObjectInputStream.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/TCLObjectInputStream.java 2007-03-02 09:13:04 UTC (rev 61043)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/TCLObjectInputStream.java 2007-03-02 09:13:54 UTC (rev 61044)
@@ -30,10 +30,10 @@
/**
* Use the TCL to load a class on a CNFE as the ObjectInputStream
- * fails to use this
+ * fails to use the TCL one would expect it to.
*
* @author Scott.Stark at jboss.org
- * @version $Revision:$
+ * @version $Revision$
*/
public class TCLObjectInputStream
extends ObjectInputStream
Property changes on: trunk/system/src/main/org/jboss/system/server/profileservice/repository/TCLObjectInputStream.java
___________________________________________________________________
Name: svn:keywords
- Id,Revision
+ Id Revision
More information about the jboss-cvs-commits
mailing list