Search in sources :

Example 1 with ClientDataSerializerMessage

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);
}
Also used : ClientDataSerializerMessage(org.apache.geode.internal.cache.tier.sockets.ClientDataSerializerMessage) InternalCache(org.apache.geode.internal.cache.InternalCache) IOException(java.io.IOException) GemFireIOException(org.apache.geode.GemFireIOException)

Aggregations

IOException (java.io.IOException)1 GemFireIOException (org.apache.geode.GemFireIOException)1 InternalCache (org.apache.geode.internal.cache.InternalCache)1 ClientDataSerializerMessage (org.apache.geode.internal.cache.tier.sockets.ClientDataSerializerMessage)1