/** * Creates a new <code>MarshalledWrapper</code> wrapping a * <code>MarshalledInstance</code> containing the given object. * * @param obj object to create <code>MarshalledInstance</code> with * @throws IOException if <code>MarshalledInstance</code> creation fails */ public MarshalledWrapper(Object obj) throws IOException { instance = new MarshalledInstance(obj); }
MarshalledObjectSerializer(MarshalledObject obj){ this(new MarshalledInstance(obj)); }
/** * Returns the handback object that was provided as a parameter to * the event interest registration method, if any. Note that if the * handback object was a MarshalledObject, it will be returned as a * MarshalledInstance. * * @return the MarshalledInstance that was provided as a parameter to * the event interest registration method, if any. * Or the MarshalledObject that was provided, converted to a * MarshalledInstance. */ public MarshalledInstance getRegistrationInstance() { if ( miHandback == null && handback != null) return new MarshalledInstance(handback); return miHandback; }
/** * @serialData RemoteEventListener as a MarshalledInstance */ private void writeObject(ObjectOutputStream stream) throws IOException { stream.defaultWriteObject(); stream.writeObject(new MarshalledInstance(listener)); }
/** * Writes locators to the given stream as a null-terminated list of MarshalledInstances. */ private static void marshalLocators(LookupLocator[] locators, ObjectOutputStream out) throws IOException { for (int i = 0; i < locators.length; i++) { out.writeObject(new MarshalledInstance(locators[i])); } out.writeObject(null); }
/** * @serialData RemoteEventListener as a MarshalledInstance */ private void writeObject(ObjectOutputStream stream) throws IOException { stream.defaultWriteObject(); stream.writeObject(new MarshalledInstance(listener)); }
/** * Writes reggie's attributes to ObjectOutputStream as a null-terminated list of * MarshalledInstances. */ private static void marshalAttributes(Entry[] attrs, ObjectOutputStream out) throws IOException { for (int i = 0; i < attrs.length; i++) { out.writeObject(new MarshalledInstance(attrs[i])); } out.writeObject(null); }
/** * @serialData RemoteEventListener as a MarshalledObject */ private void writeObject(ObjectOutputStream stream) throws IOException { stream.defaultWriteObject(); stream.writeObject(new MarshalledInstance(target).convertToMarshalledObject()); }
void activeObject(UID uid, MarshalledObject mobj) throws UnknownObjectException { getObjectEntry(uid).stub = new MarshalledWrapper(new MarshalledInstance(mobj)); }
/** * 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} ); }
/** Set the reference to the client-supplied notification target */ public synchronized void setEventTarget(RemoteEventListener preparedTarget) throws IOException { if (preparedTarget == null) { preparedEventTarget = null; marshalledEventTarget = null; } else { preparedEventTarget = preparedTarget; marshalledEventTarget = new MarshalledInstance(preparedTarget).convertToMarshalledObject(); } }
@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; } } }
/** * Creates a new <code>MarshalledWrapper</code> wrapping a <code>MarshalledInstance</code> * containing the given object. * * @param obj object to create <code>MarshalledInstance</code> with * @throws IOException if <code>MarshalledInstance</code> creation fails */ public MarshalledWrapper(Object obj) throws IOException { Object service = obj; if (!AVOID_MARSH_PIVOT && obj instanceof MarshalPivotProvider) { service = ((MarshalPivotProvider) obj).getMarshalPivot(); } instance = new MarshalledInstance(service); }
/** * @serialData Use default semantics for the <tt>id</tt> field but * write the <tt>source</tt> field out as a <tt>MarshalledObject</tt>. * The <tt>source</tt> field is written out as a <tt>MarshalledObject</tt> * to preserve the codebase annotation as well as to * guarantee that the object can be successfully read from the stream * (even if the codebase is unavailable at the time the object is * being reconstituted). * * @exception IOException if an I/O error occurs */ private void writeObject(ObjectOutputStream stream) throws IOException { stream.defaultWriteObject(); stream.writeObject(new MarshalledInstance(source).convertToMarshalledObject()); }
/** * 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; } }
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. }
@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 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); }
/** * Return an <code>EventFactory</code> that will create an * appropriate <code>RenewalFailureEvent</code> for the client * lease associated with this wrapper. This method assumes * that no one else will be setting the serialization format * of the lease during the course of the call. * @param source Source object for the event * @throws IOException if the client lease could not be pre * marshalled. */ EventFactory newFailureFactory(LeaseRenewalSet source) throws IOException { final MarshalledInstance ml = getMarshalledClientLease(); MarshalledInstance mt = null; if (lastFailure != null) mt = new MarshalledInstance(lastFailure); return new FailureFactory(source, ml, mt); }
ActiveEntry(Remote impl) throws ActivationException { this.impl = impl; try { Object proxy ; if (impl instanceof ProxyAccessor) { proxy = ((ProxyAccessor) impl).getProxy(); if (proxy == null) { throw new ActivationException( "ProxyAccessor.getProxy returned null"); } } else { proxy = impl; } this.mobj = new MarshalledInstance(proxy).convertToMarshalledObject(); } catch (IOException e) { throw new ActivationException( "failed to marshal remote object", e); } } }