use of com.hazelcast.core.HazelcastInstanceAware in project hazelcast by hazelcast.
the class ScheduledRunnableAdapter method setHazelcastInstance.
@Override
public void setHazelcastInstance(HazelcastInstance hazelcastInstance) {
if (task instanceof HazelcastInstanceAware) {
HazelcastInstanceAware instanceAwareTask = (HazelcastInstanceAware) task;
instanceAwareTask.setHazelcastInstance(hazelcastInstance);
}
}
use of com.hazelcast.core.HazelcastInstanceAware in project hazelcast by hazelcast.
the class DefaultSerializationServiceBuilder method registerSerializerHooks.
private void registerSerializerHooks(InternalSerializationService ss) {
SerializerHookLoader serializerHookLoader = new SerializerHookLoader(config, classLoader);
Map<Class, Object> serializers = serializerHookLoader.getSerializers();
for (Map.Entry<Class, Object> entry : serializers.entrySet()) {
Class serializationType = entry.getKey();
Object value = entry.getValue();
Serializer serializer;
if (value instanceof SerializerHook) {
serializer = ((SerializerHook) value).createSerializer();
} else {
serializer = (Serializer) value;
}
if (value instanceof HazelcastInstanceAware) {
((HazelcastInstanceAware) value).setHazelcastInstance(hazelcastInstance);
}
if (ClassLoaderUtil.isInternalType(value.getClass())) {
((AbstractSerializationService) ss).safeRegister(serializationType, serializer);
} else {
((AbstractSerializationService) ss).register(serializationType, serializer);
}
}
}
use of com.hazelcast.core.HazelcastInstanceAware in project hazelcast by hazelcast.
the class DefaultSerializationServiceBuilder method addConfigPortableFactories.
private void addConfigPortableFactories(final Map<Integer, PortableFactory> portableFactories, SerializationConfig config, ClassLoader cl) {
registerPortableFactories(portableFactories, config);
buildPortableFactories(portableFactories, config, cl);
for (PortableFactory f : portableFactories.values()) {
if (f instanceof HazelcastInstanceAware) {
((HazelcastInstanceAware) f).setHazelcastInstance(hazelcastInstance);
}
}
}
use of com.hazelcast.core.HazelcastInstanceAware in project hazelcast by hazelcast.
the class ReliableTopicProxy method addMessageListener.
private void addMessageListener(ListenerConfig listenerConfig) {
NodeEngine nodeEngine = getNodeEngine();
MessageListener listener = loadListener(listenerConfig);
if (listener == null) {
return;
}
if (listener instanceof HazelcastInstanceAware) {
HazelcastInstanceAware hazelcastInstanceAware = (HazelcastInstanceAware) listener;
hazelcastInstanceAware.setHazelcastInstance(nodeEngine.getHazelcastInstance());
}
addMessageListener(listener);
}
use of com.hazelcast.core.HazelcastInstanceAware in project hazelcast by hazelcast.
the class TopicProxySupport method initialize.
private void initialize(ListenerConfig listenerConfig) {
NodeEngine nodeEngine = getNodeEngine();
MessageListener listener = loadListener(listenerConfig);
if (listener == null) {
return;
}
if (listener instanceof HazelcastInstanceAware) {
HazelcastInstanceAware hazelcastInstanceAware = (HazelcastInstanceAware) listener;
hazelcastInstanceAware.setHazelcastInstance(nodeEngine.getHazelcastInstance());
}
addMessageListenerInternal(listener);
}
Aggregations