Search in sources :

Example 1 with PortableHook

use of com.hazelcast.internal.serialization.PortableHook in project hazelcast by hazelcast.

the class PortableHookLoader method load.

private void load() {
    try {
        final Iterator<PortableHook> hooks = ServiceLoader.iterator(PortableHook.class, FACTORY_ID, classLoader);
        while (hooks.hasNext()) {
            PortableHook hook = hooks.next();
            final PortableFactory factory = hook.createFactory();
            if (factory != null) {
                register(hook.getFactoryId(), factory);
            }
            final Collection<ClassDefinition> defs = hook.getBuiltinDefinitions();
            if (defs != null && !defs.isEmpty()) {
                definitions.addAll(defs);
            }
        }
    } catch (Exception e) {
        throw ExceptionUtil.rethrow(e);
    }
    if (configuredFactories != null) {
        for (Map.Entry<Integer, ? extends PortableFactory> entry : configuredFactories.entrySet()) {
            register(entry.getKey(), entry.getValue());
        }
    }
}
Also used : PortableHook(com.hazelcast.internal.serialization.PortableHook) ClassDefinition(com.hazelcast.nio.serialization.ClassDefinition) Map(java.util.Map) HashMap(java.util.HashMap) PortableFactory(com.hazelcast.nio.serialization.PortableFactory)

Aggregations

PortableHook (com.hazelcast.internal.serialization.PortableHook)1 ClassDefinition (com.hazelcast.nio.serialization.ClassDefinition)1 PortableFactory (com.hazelcast.nio.serialization.PortableFactory)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1