/** * Registers a {@code DataSerializable} class with the data serialization framework. This method * is usually invoked from the static initializer of a class that implements * {@code DataSerializable}. * * @param instantiator An {@code Instantiator} whose {@link #newInstance} method is invoked when * an object is data deserialized. * * @throws IllegalStateException If class {@code c} is already registered with a different class * id, or another class has already been registered with id {@code classId} * @throws NullPointerException If {@code instantiator} is {@code null}. */ public static synchronized void register(Instantiator instantiator) { InternalInstantiator.register(instantiator, true); }
/** * Registers a {@code DataSerializable} class with the data serialization framework. This method * is usually invoked from the static initializer of a class that implements * {@code DataSerializable}. * * @param instantiator An {@code Instantiator} whose {@link #newInstance} method is invoked when * an object is data deserialized. * * @param distribute True if the registered {@code Instantiator} has to be distributed to other * members of the distributed system. Note that if distribute is set to false it may still * be distributed in some cases. * * @throws IllegalArgumentException If class {@code c} is already registered with a different * class id, or another class has already been registered with id {@code classId} * @throws NullPointerException If {@code instantiator} is {@code null}. * @deprecated as of 9.0 use {@link Instantiator#register(Instantiator)} instead */ @Deprecated public static synchronized void register(Instantiator instantiator, boolean distribute) { InternalInstantiator.register(instantiator, distribute); }
@Override public void cmnInstantiatorId(int id, String cn, String icn) { if (cn != null && icn != null) { InternalInstantiator.register(cn, icn, id, true); this.instIds.add(id); } this.ifLiveRecordCount++; this.ifTotalRecordCount++; }
@Override public void cmnInstantiatorId(int id, Class c, Class ic) { if (c != null && ic != null) { InternalInstantiator.register(c, ic, id, true); this.instIds.add(id); } this.ifLiveRecordCount++; this.ifTotalRecordCount++; }
/** * Lazily creates a new {@code Instantiator} with the given class and id. * * 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(String instantiatorClass, String instantiatedClass, int id, boolean distribute, EventID eventId, ClientProxyMembershipID context) { register(instantiatorClass, new InstantiatorAttributesHolder(instantiatorClass, instantiatedClass, id, eventId, context), 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); } }
/** * 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); } }
/** * 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); } }
synchronized (InternalInstantiator.class) { if (!idsToInstantiators.containsKey(holder.getId())) { register(instantiatorClass, instantiatedClass, holder.getId(), false, holder.getEventId(), holder.getContext());
Integer id = (Integer) instantiator.getKey(); ArrayList instantiatorArguments = (ArrayList) instantiator.getValue(); InternalInstantiator.register((String) instantiatorArguments.get(0), (String) instantiatorArguments.get(1), id, false);
InternalInstantiator.register(instantiatorClassName, instantiatedClassName, id, false);
register(instantiatorClass, instantiatedClass, holder.getId(), false, holder.getEventId(), holder.getContext()); classNamesToHolders.remove(holder.getInstantiatedClassName());
Object inst2 = idsToInstantiators.get(holder.getId()); if (inst2 == inst) { register(instantiatorClass, instantiatedClass, holder.getId(), distribute, holder.getEventId(), holder.getContext()); } else { if (inst2 == null || inst2 instanceof Marker) { register(instantiatorClassName, holder, distribute); } else {
int id = instantiatorIds[i]; if ((instantiatorClassName != null) && (instantiatedClassName != null)) { InternalInstantiator.register(instantiatorClassName, instantiatedClassName, id, false);
.deserialize(clientMessage.getPart(i + 1).getSerializedForm()); int id = clientMessage.getPart(i + 2).getInt(); InternalInstantiator.register(instantiatorClassName, instantiatedClassName, id, false, eventId, null);
instantiatorClass = InternalDataSerializer.getCachedClass(instantiatorClassName); instantiatedClass = InternalDataSerializer.getCachedClass(instantiatedClassName); InternalInstantiator.register(instantiatorClass, instantiatedClass, id, true, eventId, serverConnection.getProxyID()); } catch (ClassNotFoundException e) {