public Object resolve( CodebaseAccessor bootstrapProxy, MarshalledInstance smartProxy, ClassLoader parentLoader, ClassLoader verifierLoader, Collection context) throws IOException, ClassNotFoundException { return smartProxy.get(parentLoader, true, verifierLoader, context); }
/** * Returns the result of calling the {@link MarshalledInstance#get(boolean) get} method of the * wrapped <code>MarshalledInstance</code>, passing the integrity value sampled during * deserialization as the <code>verifyCodebaseIntegrity</code> argument. If this * <code>MarshalledWrapper</code> instance was not produced by deserialization or was * deserialized from a stream with no integrity protection setting, then a * <code>verifyCodebaseIntegrity</code> value of <code>false</code> is used. * * @return the object unmarshalled by the wrapped <code>MarshalledInstance</code> * @throws IOException if an <code>IOException</code> occurs during unmarshalling * @throws ClassNotFoundException if any classes necessary for reconstructing the object being * unmarshalled cannot be found */ public Object get() throws IOException, ClassNotFoundException { return instance.get(integrity); }
/** * Returns the result of calling the {@link MarshalledInstance#get(boolean) * get} method of the wrapped <code>MarshalledInstance</code>, passing the * integrity value sampled during deserialization as the * <code>verifyCodebaseIntegrity</code> argument. If this * <code>MarshalledWrapper</code> instance was not produced by * deserialization or was deserialized from a stream with no integrity * protection setting, then a <code>verifyCodebaseIntegrity</code> value of * <code>false</code> is used. * * @return the object unmarshalled by the wrapped * <code>MarshalledInstance</code> * @throws IOException if an <code>IOException</code> occurs during * unmarshalling * @throws ClassNotFoundException if any classes necessary for * reconstructing the object being unmarshalled cannot be found */ public Object get() throws IOException, ClassNotFoundException { return instance.get(integrity); }
/** * Returns the lease that could not be renewed. When the event is * deserialized, the lease is left in marshalled form. It is only * unmarshalled when this call is made. If a call to this method * fails, future calls will attempt to re-unmarshal the lease. * Once the lease is successfully unmarshalled it is cached in a * transient field so future calls will not result in * <code>IOException</code> or * <code>ClassNotFoundException</code>. * * @return the unmarshalled lease * @throws IOException if there are problems unmarshalling the lease, * usually because of some sort of class mismatch * @throws ClassNotFoundException if there are problems unmarshalling the * lease, usually because one of the classes associated with the * lease's implementation could not be loaded * @throws SecurityException if this object was unmarshalled from a stream * that required codebase integrity, and the integrity of the * lease's codebase could not be verified */ public Lease getLease() throws IOException, ClassNotFoundException { if (lease == null) { lease = (Lease) marshalledLease.get(verifyCodebaseIntegrity); } return lease; };
/** * Returns a new copy of the contained object. Deserialization is performed with the semantics * defined by <code>MarshalInputStream</code>. The input stream used to unmarshal the object * implements {@link ObjectStreamContext} and returns a collection from its {@link * ObjectStreamContext#getObjectStreamContext getObjectStreamContext} method which contains a * single element of type {@link IntegrityEnforcement}; the {@link * IntegrityEnforcement#integrityEnforced integrityEnforced} method of this element returns the * specified <code>verifyCodebaseIntegrity</code> value. <p>MarshalledInstance</code> implements * this method by calling <code>{@link #get(ClassLoader, boolean, ClassLoader, Collection) * get}(null, verifyCodebaseIntegrity, null, null)</code>. * * @param verifyCodebaseIntegrity if <code>true</code> then codebase integrity is verified, * otherwise code base integrity is not verified * @return a new copy of the contained object * @throws IOException if an <code>IOException</code> occurs while deserializing the * object from its internal representation * @throws ClassNotFoundException if any classes necessary for reconstructing the contained * object can not be found or if <code>verifyCodebaseIntegrity</code> * is <code>true</code> and the integrity of the contained * object's codebase cannot be confirmed */ public Object get(final boolean verifyCodebaseIntegrity) throws IOException, ClassNotFoundException { return get(null, verifyCodebaseIntegrity, null, null); }
/** * Activation constructor * * @param activationID activation ID passed in by the activation daemon. * @param data state data needed to re-activate a Mercury server */ MailboxImpl(ActivationID activationID, MarshalledObject data) throws Exception { this((String[]) new MarshalledInstance(data).get(false), activationID, true, new Object[] {activationID, data} ); }
@Override public void read(ObjectInput stream) throws IOException, ClassNotFoundException { MarshalledObject mo = (MarshalledObject)stream.readObject(); try { source = new MarshalledInstance(mo).get(false); } catch (Throwable e) { if (e instanceof Error && !(e instanceof LinkageError || e instanceof OutOfMemoryError || e instanceof StackOverflowError)) { throw (Error)e; } } }
/** * Unmarshals the event listener. */ private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); MarshalledObject mo = (MarshalledObject)stream.readObject(); try { target = (RemoteEventListener) new MarshalledInstance(mo).get(false); } catch (Throwable e) { if (e instanceof Error && !(e instanceof LinkageError || e instanceof OutOfMemoryError || e instanceof StackOverflowError)) throw (Error)e; } }
/** * Unmarshals the event listener. */ private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); MarshalledInstance mi = (MarshalledInstance) stream.readObject(); try { listener = (RemoteEventListener) mi.get(false); } catch (Throwable e) { if (e instanceof Error && ThrowableConstants.retryable(e) == ThrowableConstants.BAD_OBJECT) { throw (Error) e; } logger.log(Level.WARNING, "failed to recover event listener", e); } } }
/** * Unmarshals the event listener. */ private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); MarshalledInstance mi = (MarshalledInstance) stream.readObject(); try { listener = (RemoteEventListener) mi.get(false); } catch (Throwable e) { if (e instanceof Error && ThrowableConstants.retryable(e) == ThrowableConstants.BAD_OBJECT) { throw (Error) e; } logger.log(Level.WARNING, "failed to recover event listener", e); } } }
private static String[] getConfigOptions(ActivationID activationID, MarshalledObject data) throws Exception{ try { if (activationID == null) { throw new NullPointerException("activationID is null"); } return (String[]) new MarshalledInstance(data).get(false); } catch (Throwable e) { initFailed(e); } return new String[0]; // Unreachable, keeps compiler happy. }
/** * Returns locators unmarshalled from a null-terminated list of MarshalledInstances read from * the given stream, logging (but tolerating) unmarshalling failures. */ private static LookupLocator[] unmarshalLocators(ObjectInputStream in) throws IOException, ClassNotFoundException { List l = new ArrayList(); MarshalledInstance mi; while ((mi = (MarshalledInstance) in.readObject()) != null) { try { l.add((LookupLocator) mi.get(false)); } catch (Throwable e) { if (e instanceof Error && ThrowableConstants.retryable(e) == ThrowableConstants.BAD_OBJECT) { throw (Error) e; } logger.log( Level.WARNING, "failed to recover lookup locator", e); } } return (LookupLocator[]) l.toArray(new LookupLocator[l.size()]); }
/** * Construct a new object, initialized by unmarshaling the * contents of an input stream. * * @param str the stream from which to unmarshal the response * @exception IOException an error occurred while unmarshaling the * response * @exception ClassNotFoundException some of the lookup service * classes could not be found or downloaded */ public IncomingUnicastResponse(InputStream str) throws IOException, ClassNotFoundException { ObjectInputStream istr = new ObjectInputStream(str); registrar = (ServiceRegistrar) new MarshalledInstance( (MarshalledObject)istr.readObject()).get(false); int grpCount = istr.readInt(); groups = new String[grpCount]; for (int i = 0; i < groups.length; i++) { groups[i] = istr.readUTF(); } }
/** * Initialize <code>id</code> field using default semantics but * then unmarshal the value of <code>source</code> from the stream. * * @exception IOException if an I/O error occurs * * @exception ClassNotFoundException if a class of a serialized object * cannot be found */ private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); MarshalledObject mo = (MarshalledObject)stream.readObject(); try { source = new MarshalledInstance(mo).get(false); } catch (Throwable e) { if (e instanceof Error && !(e instanceof LinkageError || e instanceof OutOfMemoryError || e instanceof StackOverflowError)) { throw (Error)e; } } }
@Override public void read(ObjectInput stream) throws IOException, ClassNotFoundException { MarshalledObject mo = (MarshalledObject)stream.readObject(); try { listener = (RemoteEventListener) new MarshalledInstance(mo).get(false); } catch (Throwable e) { problemLogger.log(Level.INFO, "problem recovering listener " +"for recovered registration", e); if((e instanceof Error) && (ThrowableConstants.retryable(e) == ThrowableConstants.BAD_OBJECT)) { throw (Error)e; }//endif } }
/** * Returns reggie's attributes unmarshalled from a null-terminated list of MarshalledInstances * read from the given stream, logging (but tolerating) unmarshalling failures. */ private static Entry[] unmarshalAttributes(ObjectInputStream in) throws IOException, ClassNotFoundException { ArrayList attributes = new ArrayList(); MarshalledInstance mi = null; while ((mi = (MarshalledInstance) in.readObject()) != null) { try { attributes.add((Entry) mi.get(false)); } catch (Throwable e) { if (e instanceof Error && ThrowableConstants.retryable(e) == ThrowableConstants.BAD_OBJECT) { throw (Error) e; } logger.log( Level.WARNING, "failed to recover LUS attribute", e); } } Entry[] attrs = new Entry[attributes.size()]; return (Entry[]) attributes.toArray(attrs); }
/** When this class is deserialized, this method is invoked. This * method first deserializes the non-transient elements of this * class, and then unmarshals the remote event listener. (See the * description for <code>writeObject</code> above.) */ private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); MarshalledObject mo = (MarshalledObject)stream.readObject(); try { listener = (RemoteEventListener) new MarshalledInstance(mo).get(false); } catch (Throwable e) { problemLogger.log(Level.INFO, "problem recovering listener " +"for recovered registration", e); if((e instanceof Error) && (ThrowableConstants.retryable(e) == ThrowableConstants.BAD_OBJECT)) { throw (Error)e; }//endif } }//end readObject
/** * Returns the configuration obtained from the specified marshalled * object. */ private static Configuration getConfiguration(MarshalledObject mobj) throws ConfigurationException, IOException, ClassNotFoundException { /* mobj must be MarshalledObject unmarshalled */ ClassLoader ccl = Thread.currentThread().getContextClassLoader(); ClassLoader cl = AbstractActivationGroup.class.getClassLoader(); Thread.currentThread().setContextClassLoader(cl); ActivationGroupData data = (ActivationGroupData) new MarshalledInstance(mobj).get(false); Thread.currentThread().setContextClassLoader(ccl); if (!covers(cl, ccl)) { cl = ccl; } return ConfigurationProvider.getInstance(data.getConfig(), cl); }
public void restoreTransientState(ProxyPreparer targetPreparer) throws IOException, ClassNotFoundException { if (targetPreparer == null) { throw new NullPointerException( "targetPreparer cannot be null"); } synchronized (this){ if (marshalledEventTarget != null) { RemoteEventListener unprepared = (RemoteEventListener) new MarshalledInstance(marshalledEventTarget).get(false); preparedEventTarget = (RemoteEventListener) targetPreparer.prepareProxy(unprepared); } } /* * Note: Would like to defer preparation until listener * is needed (i.e. in getEventTarget()). Unfortunately, * listeners are obtained within "locks" and proxy * preparation (i.e. possible remote calls) should * not be done while holding those locks. */ }
/** * Returns the next available <tt>RemoteEvent</tt> from the stream. * * @exception IOException * Thrown if an I/O error occurs * @exception ClassNotFoundException Thrown if the class of a * serialized object cannot be found. */ public RemoteEvent read(InputStream in) throws IOException, ClassNotFoundException { // Set the target stream sin.setInputStream(in); try { // Retrieve next event which was stored as a // MarshalledObject and return its contents. MarshalledObject mo = (MarshalledObject)ein.readObject(); return (RemoteEvent) new MarshalledInstance(mo).get(false); } finally { // Reset target stream to null sin.setInputStream(null); } } }