use of org.apache.drill.exec.coord.store.TransientStoreEventType in project drill by axbaretto.
the class EventDispatcher method childEvent.
@Override
public void childEvent(final CuratorFramework client, final PathChildrenCacheEvent event) throws Exception {
final PathChildrenCacheEvent.Type original = event.getType();
final TransientStoreEventType mapped = MAPPINGS.get(original);
if (mapped != null) {
// dispatch the event to listeners only if it can be mapped
final String path = event.getData().getPath();
final byte[] bytes = event.getData().getData();
final V value = store.getConfig().getSerializer().deserialize(bytes);
store.fireListeners(TransientStoreEvent.of(mapped, path, value));
}
}
use of org.apache.drill.exec.coord.store.TransientStoreEventType in project drill by apache.
the class EventDispatcher method childEvent.
@Override
public void childEvent(final CuratorFramework client, final PathChildrenCacheEvent event) throws Exception {
final PathChildrenCacheEvent.Type original = event.getType();
final TransientStoreEventType mapped = MAPPINGS.get(original);
if (mapped != null) {
// dispatch the event to listeners only if it can be mapped
final String path = event.getData().getPath();
final byte[] bytes = event.getData().getData();
final V value = store.getConfig().getSerializer().deserialize(bytes);
store.fireListeners(TransientStoreEvent.of(mapped, path, value));
}
}
use of org.apache.drill.exec.coord.store.TransientStoreEventType in project drill by axbaretto.
the class MapBackedStore method put.
@Override
public V put(final String key, final V value) {
final boolean hasKey = delegate.containsKey(key);
final V old = delegate.put(key, value);
if (old != value) {
final TransientStoreEventType type = hasKey ? TransientStoreEventType.UPDATE : TransientStoreEventType.CREATE;
fireListeners(TransientStoreEvent.of(type, key, value));
}
return old;
}
use of org.apache.drill.exec.coord.store.TransientStoreEventType in project drill by apache.
the class MapBackedStore method put.
@Override
public V put(final String key, final V value) {
final boolean hasKey = delegate.containsKey(key);
final V old = delegate.put(key, value);
if (old != value) {
final TransientStoreEventType type = hasKey ? TransientStoreEventType.UPDATE : TransientStoreEventType.CREATE;
fireListeners(TransientStoreEvent.of(type, key, value));
}
return old;
}
Aggregations