Package org.apache.geronimo.kernel

Examples of org.apache.geronimo.kernel.ObjectInputStreamExt


            // Set the thread context classloader so deserializing classes can grab the cl from the thread
            ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
            try {
                Thread.currentThread().setContextClassLoader(classLoader);

                ObjectInputStream ois = new ObjectInputStreamExt(new ByteArrayInputStream(gbeanState), classLoader);
                try {
                    while (true) {
                        GBeanData gbeanData = new GBeanData();
                        gbeanData.readExternal(ois);
                        gbeans.add(gbeanData);
                    }
                } catch (EOFException e) {
                    // ok
                } finally {
                    ois.close();
                }
            } catch (Exception e) {
                throw new InvalidConfigException("Unable to deserialize GBeanState", e);
            } finally {
                Thread.currentThread().setContextClassLoader(oldCl);
View Full Code Here


     * @return
     * @throws IOException
     * @throws ClassNotFoundException
     */
    static public Object deserialize(Packet response, ClassLoader cl) throws IOException, ClassNotFoundException {
        ObjectInputStreamExt is = new ObjectInputStreamExt(new PacketToInputStream(response), cl);
        Object rc = is.readObject();
        is.close();
        return rc;
    }
View Full Code Here

            // Set the thread context classloader so deserializing classes can grab the cl from the thread
            ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
            try {
                Thread.currentThread().setContextClassLoader(classLoader);

                ObjectInputStream ois = new ObjectInputStreamExt(new ByteArrayInputStream(gbeanState), classLoader);
                try {
                    while (true) {
                        GBeanData gbeanData = new GBeanData();
                        gbeanData.readExternal(ois);
                        gbeans.add(gbeanData);
                    }
                } catch (EOFException e) {
                    // ok
                } finally {
                    ois.close();
                }
            } catch (ClassNotFoundException e) {
                throw new InvalidConfigException("Class not loadable in classloader: " + classLoader, e);
            } catch (NoClassDefFoundError e) {
                throw new InvalidConfigException("Class not loadable in classloader: " + classLoader, e);
View Full Code Here

            // Set the thread context classloader so deserializing classes can grab the cl from the thread
            ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
            try {
//                Thread.currentThread().setContextClassLoader(classLoader);

                ObjectInputStream ois = new ObjectInputStreamExt(new ByteArrayInputStream(gbeanState), bundle);
                try {
                    while (true) {
                        GBeanData gbeanData = new GBeanData();
                        gbeanData.readExternal(ois);
                        gbeans.add(gbeanData);
                    }
                } catch (EOFException e) {
                    // ok
                } finally {
                    ois.close();
                }
            } catch (ClassNotFoundException e) {
                throw new InvalidConfigException("Class not loadable in classloader: " + bundle, e);
            } catch (NoClassDefFoundError e) {
                throw new InvalidConfigException("Class not loadable in classloader: " + bundle, e);
View Full Code Here

     * @return
     * @throws IOException
     * @throws ClassNotFoundException
     */
    static public Object deserialize(Packet response, ClassLoader cl) throws IOException, ClassNotFoundException {
        ObjectInputStreamExt is = new ObjectInputStreamExt(new PacketToInputStream(response), cl);
        Object rc = is.readObject();
        is.close();
        return rc;
    }
View Full Code Here

    public void setClassLoader(ClassLoader classLoader) {
        super.setClassLoader(classLoader);
        ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
        try {
            ObjectInputStream is = new ObjectInputStreamExt(bais, classLoader);
            try {
                content = is.readObject();
            } finally {
                is.close();
            }
        } catch (IOException e) {
            throw new RuntimeException("Could not deserialize content", e);
        } catch (ClassNotFoundException e) {
            throw new RuntimeException("Could not deserialize content", e);
View Full Code Here

     * @throws InvalidConfigException if there is a problem deserializing the state
     */
    private static Collection loadGBeans(byte[] gbeanState, ClassLoader cl) throws InvalidConfigException {
        Map gbeans = new HashMap();
        try {
            ObjectInputStream ois = new ObjectInputStreamExt(new ByteArrayInputStream(gbeanState), cl);
            try {
                while (true) {
                    GBeanData gbeanData = new GBeanData();
                    gbeanData.readExternal(ois);

                    gbeans.put(gbeanData.getName(), gbeanData);
                }
            } catch (EOFException e) {
                // ok
            } finally {
                ois.close();
            }
            // avoid duplicate object names
            return gbeans.values();
        } catch (Exception e) {
            throw new InvalidConfigException("Unable to deserialize GBeanState", e);
View Full Code Here

            // Set the thread context classloader so deserializing classes can grab the cl from the thread
            ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
            try {
                Thread.currentThread().setContextClassLoader(classLoader);

                ObjectInputStream ois = new ObjectInputStreamExt(new ByteArrayInputStream(gbeanState), classLoader);
                try {
                    while (true) {
                        GBeanData gbeanData = new GBeanData();
                        gbeanData.readExternal(ois);
                        gbeans.add(gbeanData);
                    }
                } catch (EOFException e) {
                    // ok
                } finally {
                    ois.close();
                }
            } catch (ClassNotFoundException e) {
                throw new InvalidConfigException("Class not loadable in classloader: " + classLoader, e);
            } catch (NoClassDefFoundError e) {
                throw new InvalidConfigException("Class not loadable in classloader: " + classLoader, e);
View Full Code Here

            // Set the thread context classloader so deserializing classes can grab the cl from the thread
            ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
            try {
                Thread.currentThread().setContextClassLoader(classLoader);

                ObjectInputStream ois = new ObjectInputStreamExt(new ByteArrayInputStream(gbeanState), classLoader);
                try {
                    while (true) {
                        GBeanData gbeanData = new GBeanData();
                        gbeanData.readExternal(ois);
                        gbeans.add(gbeanData);
                    }
                } catch (EOFException e) {
                    // ok
                } finally {
                    ois.close();
                }
            } catch (ClassNotFoundException e) {
                throw new InvalidConfigException("Class not loadable in classloader: " + classLoader, e);
            } catch (NoClassDefFoundError e) {
                throw new InvalidConfigException("Class not loadable in classloader: " + classLoader, e);
View Full Code Here

     * @return
     * @throws IOException
     * @throws ClassNotFoundException
     */
    static public Object deserialize(Packet response, ClassLoader cl) throws IOException, ClassNotFoundException {
        ObjectInputStreamExt is = new ObjectInputStreamExt(new PacketToInputStream(response), cl);
        Object rc = is.readObject();
        is.close();
        return rc;
    }
View Full Code Here

TOP

Related Classes of org.apache.geronimo.kernel.ObjectInputStreamExt

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.