use of org.apache.geode.internal.cache.tier.sockets.ClientDataSerializerMessage in project geode by apache.
the class InternalDataSerializer method sendRegistrationMessageToClients.
private static void sendRegistrationMessageToClients(DataSerializer dataSerializer) {
InternalCache cache = GemFireCacheImpl.getInstance();
if (cache == null) {
// we can't propagate it to clients
return;
}
byte[][] serializedDataSerializer = new byte[2][];
try {
serializedDataSerializer[0] = CacheServerHelper.serialize(dataSerializer.getClass().toString().substring(6));
byte[] idBytes = new byte[4];
Part.encodeInt(dataSerializer.getId(), idBytes);
serializedDataSerializer[1] = idBytes;
} catch (IOException ignored) {
if (logger.isTraceEnabled(LogMarker.SERIALIZER)) {
logger.trace(LogMarker.SERIALIZER, "InternalDataSerializer encountered an IOException while serializing DataSerializer :{}", dataSerializer);
}
}
ClientDataSerializerMessage clientDataSerializerMessage = new ClientDataSerializerMessage(EnumListenerEvent.AFTER_REGISTER_DATASERIALIZER, serializedDataSerializer, (ClientProxyMembershipID) dataSerializer.getContext(), (EventID) dataSerializer.getEventId(), new Class[][] { dataSerializer.getSupportedClasses() });
// Deliver it to all the clients
CacheClientNotifier.routeClientMessage(clientDataSerializerMessage);
}
Aggregations