Skip to main content

[glassfish~svn:62355] Use OsgiObjectInputOutputStream for checkpoints serialization

  • From: andriy.zhdanov@...
  • To: commits@...
  • Subject: [glassfish~svn:62355] Use OsgiObjectInputOutputStream for checkpoints serialization
  • Date: Tue, 16 Jul 2013 13:23:22 +0000

Project:    glassfish
Repository: svn
Revision:   62355
Author:     andriy.zhdanov
Date:       2013-07-16 13:23:21 UTC
Link:       

Log Message:
------------
Use OsgiObjectInputOutputStream for checkpoints serialization


Revisions:
----------
62355


Modified Paths:
---------------
trunk/main/nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/admin/CheckpointHelper.java


Diffs:
------
Index: 
trunk/main/nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/admin/CheckpointHelper.java
===================================================================
--- 
trunk/main/nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/admin/CheckpointHelper.java
      (revision 62354)
+++ 
trunk/main/nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/admin/CheckpointHelper.java
      (revision 62355)
@@ -59,7 +59,6 @@
 import javax.security.auth.login.LoginException;
 
 import org.glassfish.admin.payload.PayloadImpl;
-import org.glassfish.api.admin.AdminCommandContext;
 import org.glassfish.api.admin.Payload;
 import org.glassfish.api.admin.Payload.Inbound;
 import org.glassfish.api.admin.Payload.Outbound;
@@ -67,20 +66,15 @@
 
 import com.sun.enterprise.util.io.FileUtils;
 import java.io.FilenameFilter;
-import java.io.InputStream;
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.EnumMap;
-import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
-import org.glassfish.api.admin.AdminCommand;
-import org.glassfish.api.admin.CommandRunner;
 import org.glassfish.api.admin.Job;
-import org.glassfish.api.admin.JobCreator;
 import org.glassfish.api.admin.JobManager;
+import org.glassfish.common.util.ObjectInputOutputStreamFactory;
 import org.glassfish.hk2.api.ServiceLocator;
 import 
org.glassfish.security.services.api.authentication.AuthenticationService;
 import org.jvnet.hk2.annotations.Service;
@@ -224,18 +218,17 @@
 
     @Inject
     ServiceLocator serviceLocator;
+
+    @Inject
+    ObjectInputOutputStreamFactory factory;
     
-    @Inject
-    CommandRunner runner;
-
     public void save(JobManager.Checkpoint checkpoint) throws IOException {
         CheckpointFilename cf = 
CheckpointFilename.createBasic(checkpoint.getJob());
         ObjectOutputStream oos = null;
         FileOutputStream fos = null;
         try {
             fos = new FileOutputStream(cf.getFile());
-            writeHeader(fos, checkpoint.getJob());
-            oos = new ObjectOutputStream(fos);
+            oos = factory.createObjectOutputStream(fos);
             oos.writeObject(checkpoint);
             oos.close();
             Outbound outboundPayload = 
checkpoint.getContext().getOutboundPayload();
@@ -273,7 +266,7 @@
         CheckpointFilename cf = CheckpointFilename.createAttachment(job, 
attachmentId);
         try {
             fos = new FileOutputStream(cf.getFile());
-            writeHeader(fos, job);
+            oos = factory.createObjectOutputStream(fos);
             oos = new ObjectOutputStream(fos);
             oos.writeObject(data);
         } finally {
@@ -290,7 +283,7 @@
         JobManager.Checkpoint checkpoint;
         try {
             fis = new FileInputStream(cf.getFile());
-            ois = getObjectInputStream(fis, readHeader(fis));
+            ois = factory.createObjectInputStream(fis);
             checkpoint = (JobManager.Checkpoint) ois.readObject();
         } finally {
             try {ois.close();} catch (Exception ex) {
@@ -324,7 +317,7 @@
         FileInputStream fis = null;
         try {
             fis = new FileInputStream(cf.getFile());
-            ois = getObjectInputStream(fis, readHeader(fis));
+            ois = factory.createObjectInputStream(fis);
             return (Serializable) ois.readObject();
         } finally {
             try {ois.close();} catch (Exception ex) {
@@ -336,7 +329,7 @@
     
     public Collection<CheckpointFilename> listCheckpoints(File dir) {
         if (dir == null || !dir.exists()) {
-            return Collections.EMPTY_LIST;
+            return Collections.emptyList();
         }
         final String extension = 
CheckpointFilename.EXTENSIONS.get(CheckpointFilename.ExtensionType.BASIC);
         File[] checkpointFiles = dir.listFiles(new FilenameFilter() {
@@ -355,10 +348,10 @@
             }
             return result;
         } else {
-            return Collections.EMPTY_LIST;
+            return Collections.emptyList();
         }
     }
-    
+/*
     private void writeHeader(OutputStream os, Job job) throws IOException {
         writeHeader(os, StringUtils.nvl(job.getScope()) + job.getName());
     }
@@ -407,7 +400,6 @@
         cls.addAll(getJobCreators());
         return new ObjectInputStreamForClassloader(is, cls);
     }
-    
     private List<ClassLoader> getJobCreators() {
         List<JobCreator> jcs = 
serviceLocator.getAllServices(JobCreator.class);
         if (jcs == null) {
@@ -419,6 +411,7 @@
         }
         return result;
     }
+*/    
 
     private void saveOutbound(Payload.Outbound outbound, File outboundFile) 
throws IOException {
         FileOutputStream os = new FileOutputStream(outboundFile);





[glassfish~svn:62355] Use OsgiObjectInputOutputStream for checkpoints serialization

andriy . zhdanov 07/16/2013
 
 
Close
loading
Please Confirm
Close