private static Object copy(final Object source) throws Exception { IntraVmCopyMonitor.preCrossClassLoaderOperation(); try { final ByteArrayOutputStream baos = new ByteArrayOutputStream(4096); final ObjectOutputStream out = new ObjectOutputStream(baos); out.writeObject(source); out.close(); final ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); final ObjectInputStream in = new EjbObjectInputStream(bais); return in.readObject(); } finally { IntraVmCopyMonitor.postCrossClassLoaderOperation(); } } }
protected Class resolveProxyClass(String[] interfaces) throws IOException, ClassNotFoundException { Class[] cinterfaces = new Class[interfaces.length]; for (int i = 0; i < interfaces.length; i++) cinterfaces[i] = getClassloader().loadClass(interfaces[i]); try { return Proxy.getProxyClass(getClassloader(), cinterfaces); } catch (IllegalArgumentException e) { throw new ClassNotFoundException(null, e); } }
private static Object copy(final Object source) throws Exception { IntraVmCopyMonitor.preCrossClassLoaderOperation(); try { final ByteArrayOutputStream baos = new ByteArrayOutputStream(4096); final ObjectOutputStream out = new ObjectOutputStream(baos); out.writeObject(source); out.close(); final ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); final ObjectInputStream in = new EjbObjectInputStream(bais); return in.readObject(); } finally { IntraVmCopyMonitor.postCrossClassLoaderOperation(); } } }
protected Class resolveProxyClass(final String[] interfaces) throws IOException, ClassNotFoundException { final Class[] cinterfaces = new Class[interfaces.length]; for (int i = 0; i < interfaces.length; i++) { cinterfaces[i] = getClassloader().loadClass(interfaces[i]); } try { return Proxy.getProxyClass(getClassloader(), cinterfaces); } catch (final IllegalArgumentException e) { throw new ClassNotFoundException(null, e); } }
private static Object copy(final Object source) throws Exception { IntraVmCopyMonitor.preCrossClassLoaderOperation(); try { final ByteArrayOutputStream baos = new ByteArrayOutputStream(4096); final ObjectOutputStream out = new ObjectOutputStream(baos); out.writeObject(source); out.close(); final ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); final ObjectInputStream in = new EjbObjectInputStream(bais); final Object copy = in.readObject(); return copy; } finally { IntraVmCopyMonitor.postCrossClassLoaderOperation(); } } }
@Override protected Class resolveProxyClass(final String[] interfaces) throws IOException, ClassNotFoundException { final Class[] cinterfaces = new Class[interfaces.length]; for (int i = 0; i < interfaces.length; i++) { cinterfaces[i] = getClassloader().loadClass(interfaces[i]); } try { return Proxy.getProxyClass(getClassloader(), cinterfaces); } catch (final IllegalArgumentException e) { throw new ClassNotFoundException(null, e); } }
private static Object copy(Object source) throws Exception { IntraVmCopyMonitor.preCrossClassLoaderOperation(); try { ByteArrayOutputStream baos = new ByteArrayOutputStream(4096); ObjectOutputStream out = new ObjectOutputStream(baos); out.writeObject(source); out.close(); ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); ObjectInputStream in = new EjbObjectInputStream(bais); Object copy = in.readObject(); return copy; } finally { IntraVmCopyMonitor.postCrossClassLoaderOperation(); } } }
protected Class resolveClass(ObjectStreamClass classDesc) throws IOException, ClassNotFoundException { try { return Class.forName(classDesc.getName(), false, getClassloader()); } catch (ClassNotFoundException e) { String n = classDesc.getName(); if (n.equals("boolean")) return boolean.class; if (n.equals("byte")) return byte.class; if (n.equals("char")) return char.class; if (n.equals("short")) return short.class; if (n.equals("int")) return int.class; if (n.equals("long")) return long.class; if (n.equals("float")) return float.class; if (n.equals("double")) return double.class; throw e; } }
private static Object copy(Object source) throws Exception { IntraVmCopyMonitor.preCrossClassLoaderOperation(); try { ByteArrayOutputStream baos = new ByteArrayOutputStream(4096); ObjectOutputStream out = new ObjectOutputStream(baos); out.writeObject(source); out.close(); ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); ObjectInputStream in = new EjbObjectInputStream(bais); Object copy = in.readObject(); return copy; } finally { IntraVmCopyMonitor.postCrossClassLoaderOperation(); } } }
final String checkedName = BlacklistClassResolver.DEFAULT.check(classDesc.getName()); try { return Class.forName(checkedName, false, getClassloader()); } catch (final ClassNotFoundException e) { final String n = classDesc.getName();
private static Object copy(Object source) throws Exception { IntraVmCopyMonitor.preCrossClassLoaderOperation(); try { ByteArrayOutputStream baos = new ByteArrayOutputStream(4096); ObjectOutputStream out = new ObjectOutputStream(baos); out.writeObject(source); out.close(); ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); ObjectInputStream in = new EjbObjectInputStream(bais); Object copy = in.readObject(); return copy; } finally { IntraVmCopyMonitor.postCrossClassLoaderOperation(); } } }
final String checkedName = BlacklistClassResolver.DEFAULT.check(classDesc.getName()); try { return Class.forName(checkedName, false, getClassloader()); } catch (final ClassNotFoundException e) { final String n = classDesc.getName();
private static Object copy(Object source) throws Exception { IntraVmCopyMonitor.preCrossClassLoaderOperation(); try { ByteArrayOutputStream baos = new ByteArrayOutputStream(4096); ObjectOutputStream out = new ObjectOutputStream(baos); out.writeObject(source); out.close(); ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); ObjectInputStream in = new EjbObjectInputStream(bais); Object copy = in.readObject(); return copy; } finally { IntraVmCopyMonitor.postCrossClassLoaderOperation(); } } }
public Object activate(Object primaryKey) throws SystemException { try { String filename = primaryKey.toString().replace(':', '='); File sessionFile = new File(sessionDirectory, filename); if (sessionFile.exists()) { logger.info("Activating from file " + sessionFile); InputStream in = new FileInputStream(sessionFile); in = new BufferedInputStream(in); ObjectInputStream ois = new EjbObjectInputStream(in); Object state = ois.readObject(); ois.close(); sessionFile.delete(); return state; } else { logger.info("Activation failed: file not found " + sessionFile); return null; } } catch (Exception t) { logger.info("Activation failed ", t); throw new SystemException(t); } } }
ObjectInputStream in = new EjbObjectInputStream(bais); Object obj = in.readObject(); return (T) obj;
final ObjectInputStream in = new EjbObjectInputStream(bais); final Object obj = in.readObject(); return (T) obj;
final ObjectInputStream in = new EjbObjectInputStream(bais); final Object obj = in.readObject(); return (T) obj;
@Override public Object activate(final Object primaryKey) throws SystemException { try { final String filename = primaryKey.toString().replace(':', '='); final File sessionFile = new File(sessionDirectory, filename); if (sessionFile.exists()) { logger.info("Activating from file " + sessionFile); try (final InputStream source = IO.read(sessionFile); final ObjectInputStream ois = new EjbObjectInputStream(source)) { return ois.readObject(); } finally { if (!sessionFile.delete()) { sessionFile.deleteOnExit(); } } } else { logger.info("Activation failed: file not found " + sessionFile); return null; } } catch (final Exception t) { logger.info("Activation failed ", t); throw new SystemException(t); } } }
@Override public Object activate(final Object primaryKey) throws SystemException { try { final String filename = primaryKey.toString().replace(':', '='); final File sessionFile = new File(sessionDirectory, filename); if (sessionFile.exists()) { logger.info("Activating from file " + sessionFile); final ObjectInputStream ois = new EjbObjectInputStream(IO.read(sessionFile)); try { return ois.readObject(); } finally { IO.close(ois); if (!sessionFile.delete()) { sessionFile.deleteOnExit(); } } } else { logger.info("Activation failed: file not found " + sessionFile); return null; } } catch (final Exception t) { logger.info("Activation failed ", t); throw new SystemException(t); } } }