/** * Registers an {@code Instantiator} with the data serialization framework. */ public static void register(Instantiator instantiator, boolean distribute) { // [sumedh] Skip the checkForThread() check if the instantiation has not // to be distributed. This allows instantiations from ServerConnection // thread in client security plugins, for example. This is particularly // useful for native clients that do not send a REGISTER_INSTANTIATORS // message rather rely on server side registration, so each server can // do the registration with distribute set to false. if (!distribute || checkForThread()) { _register(instantiator, distribute); } }
/** * Lazily creates a new {@code Instantiator} with the given class and id. * * @throws IllegalArgumentException The instantiator cannot be created * @throws IllegalStateException The instantiator cannot be registered */ public static void register(String instantiatorClass, String instantiatedClass, int id, boolean distribute) { if (checkForThread()) { register(instantiatorClass, new InstantiatorAttributesHolder(instantiatorClass, instantiatedClass, id), distribute); } }
/** * 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); } }