private static IntraVmCopyMonitor getMonitor() { IntraVmCopyMonitor monitor = threadMonitor.get(); if (monitor == null) { monitor = new IntraVmCopyMonitor(); threadMonitor.set(monitor); } return monitor; }
public static void pre(final State state) { getMonitor().state = state; }
public static void postCopyOperation() { post(); }
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 Object _writeReplace(Object proxy) throws ObjectStreamException { /* * If the proxy is being copied between bean instances in a RPC * call we use the IntraVmArtifact */ if (IntraVmCopyMonitor.isIntraVmCopyOperation()) { return new IntraVmArtifact(proxy); /* * If the proxy is referenced by a stateful bean that is being * passivated by the container we allow this object to be serialized. */ } else if (IntraVmCopyMonitor.isStatefulPassivationOperation()) { return proxy; /* * If the proxy is being copied between class loaders * we allow this object to be serialized. */ } else if (IntraVmCopyMonitor.isCrossClassLoaderOperation()) { return proxy; /* * If the proxy is serialized outside the core container system, * we allow the application server to handle it. */ } else { ApplicationServer applicationServer = ServerFederation.getApplicationServer(); return applicationServer.getEJBHome(this.getProxyInfo()); } }
protected Object writeReplace() throws ObjectStreamException { if (IntraVmCopyMonitor.isStatefulPassivationOperation()) { return new JndiEncArtifact(this); } else if (IntraVmCopyMonitor.isCrossClassLoaderOperation()) { return new JndiEncArtifact(this); } throw new NotSerializableException("IntraVM java.naming.Context objects can not be passed as arguments"); }
public static void preCrossClassLoaderOperation() { pre(State.CLASSLOADER_COPY); }
public static boolean isStatefulPassivationOperation() { return state() == State.PASSIVATION; }
private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); final ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class); setBeanContext(containerSystem.getBeanContext(deploymentID)); container = (RpcContainer) getBeanContext().getContainer(); if (IntraVmCopyMonitor.isCrossClassLoaderOperation()) { setDoCrossClassLoaderCopy(true); } setInterfaces((List<Class>) in.readObject()); setMainInterface((Class) in.readObject()); }
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(); } } }
if (IntraVmCopyMonitor.isIntraVmCopyOperation()) { return new IntraVmArtifact(this); } else if (IntraVmCopyMonitor.isStatefulPassivationOperation()) { return this; } else if (IntraVmCopyMonitor.isCrossClassLoaderOperation()) { return this;
protected Object writeReplace() throws ObjectStreamException { if (IntraVmCopyMonitor.isStatefulPassivationOperation()) { return new JndiEncArtifact(this); } else if (IntraVmCopyMonitor.isCrossClassLoaderOperation()) { return new JndiEncArtifact(this); } throw new NotSerializableException("IntraVM java.naming.Context objects can not be passed as arguments"); }
public static void prePassivationOperation() { pre(State.PASSIVATION); }
public static boolean isCrossClassLoaderOperation() { return state() == State.CLASSLOADER_COPY; } }
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { in.defaultReadObject(); ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class); setDeploymentInfo(containerSystem.getDeploymentInfo(deploymentID)); container = (RpcContainer) getDeploymentInfo().getContainer(); if (IntraVmCopyMonitor.isCrossClassLoaderOperation()) { setDoCrossClassLoaderCopy(true); } setInterfaces((List<Class>) in.readObject()); setMainInterface((Class) in.readObject()); }
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(); } } }
if (IntraVmCopyMonitor.isIntraVmCopyOperation()) { return new IntraVmArtifact(proxy); } else if (IntraVmCopyMonitor.isStatefulPassivationOperation()) { return proxy; } else if (IntraVmCopyMonitor.isCrossClassLoaderOperation()) { return proxy;