List of usage examples for java.io Externalizable getClass
@HotSpotIntrinsicCandidate public final native Class<?> getClass();
From source file:org.apache.ignite.GridTestIoUtils.java
/** * @param <T> Type of result object. * @param obj Object to marshal/unmarshal. * @param marshaller Marshaller to use for serialization. * @return The same object, but passed through marshaller: obj->marshal->buf->unmarshal->copy. * @throws Exception If failed.//from w w w . j av a2 s.c o m */ @SuppressWarnings("unchecked") public static <T> T externalize(Externalizable obj, Marshaller marshaller) throws Exception { assert marshaller != null; byte[] buf = marshaller.marshal(obj); // Sleep to make sure that clock advances (necessary for some tests) Thread.sleep(10); return (T) marshaller.unmarshal(buf, obj.getClass().getClassLoader()); }
From source file:org.gridgain.grid.GridTestIoUtils.java
/** * @param <T> Type of result object. * @param obj Object to marshal/unmarshal. * @param marshaller Marshaller to use for serialization. * @return The same object, but passed through marshaller: obj->marshal->buf->unmarshal->copy. * @throws Exception If failed.// www . j av a 2 s . c o m */ @SuppressWarnings("unchecked") public static <T> T externalize(Externalizable obj, GridMarshaller marshaller) throws Exception { assert marshaller != null; byte[] buf = marshaller.marshal(obj); // Sleep to make sure that clock advances (necessary for some tests) Thread.sleep(10); return (T) marshaller.unmarshal(buf, obj.getClass().getClassLoader()); }