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(); } } }
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(); } } }
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(); } } }
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(); } } }
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(); } } }
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(); } } }
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 ObjectInputStream in = new EjbObjectInputStream(bais); final Object obj = in.readObject(); return (T) obj;
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;
@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); } } }