/** * Creates a new {@code Instantiator} with the given class and id and * {@linkplain #register(Instantiator, boolean) registers} it with the data serialization * framework. * * @throws IllegalArgumentException The instantiator cannot be created * @throws IllegalStateException The instantiator cannot be registered */ public static void register(Class instantiatorClass, Class instantiatedClass, int id, boolean distribute) { if (checkForThread()) { Instantiator inst = newInstance(instantiatorClass, instantiatedClass, id); _register(inst, distribute); } }
@Override protected void process(ClusterDistributionManager dm) { if (this.fromDataProblems != null) { if (logger.isDebugEnabled()) { logger.debug(this.fromDataProblems); } } if (this.instantiatorClass != null && this.instantiatedClass != null) { Instantiator s = newInstance(this.instantiatorClass, this.instantiatedClass, this.id); s.setEventId(eventId); InternalInstantiator.register(s, false); } else if (this.instantiatorClassName != null && this.instantiatedClassName != null) { InternalInstantiator.register(this.instantiatorClassName, this.instantiatedClassName, this.id, false, this.eventId, null); } }
@Override protected void process(ClusterDistributionManager dm) { if (fromDataProblems != null) { if (logger.isDebugEnabled()) { logger.debug(fromDataProblems); } } if (this.instantiatorClass != null && this.instantiatedClass != null) { Instantiator s = newInstance(this.instantiatorClass, this.instantiatedClass, this.id); s.setEventId(this.eventId); s.setContext(this.context); InternalInstantiator.register(s, false); } else if (this.instantiatorClassName != null && this.instantiatedClassName != null) { InternalInstantiator.register(this.instantiatorClassName, this.instantiatedClassName, this.id, false, this.eventId, this.context); } }
/** * Read the data from in and register it with this class. * * @throws IllegalArgumentException if a registration fails */ public static void loadRegistrations(DataInput in) throws IOException { int instId; while ((instId = in.readInt()) != 0) { Class instClass = null; Class instantiatedClass = null; boolean skip = false; try { instClass = DataSerializer.readClass(in); } catch (ClassNotFoundException ex) { skip = true; } try { instantiatedClass = DataSerializer.readClass(in); } catch (ClassNotFoundException ex) { skip = true; } if (skip) { continue; } register(newInstance(instClass, instantiatedClass, instId), true); } }
/** * Creates a new {@code Instantiator} with the given class and id and * {@linkplain #register(Instantiator, boolean) registers} it with the data serialization * framework. * * This method is only called when server connection and CacheClientUpdaterThread * * @throws IllegalArgumentException The instantiator cannot be created * @throws IllegalStateException The instantiator cannot be registered */ public static void register(Class instantiatorClass, Class instantiatedClass, int id, boolean distribute, EventID eventId, ClientProxyMembershipID context) { Instantiator inst = newInstance(instantiatorClass, instantiatedClass, id); // This method is only called when server connection and CacheClientUpdaterThread inst.setEventId(eventId); inst.setContext(context); _register(inst, distribute); }