* Returns a registry of protocol buffer extensions of all the currently
* registered key versions.
*/
public ExtensionRegistry getProtoExtensions() {
synchronized (keyVersions) {
ExtensionRegistry registry = cachedProtoExtensions;
if (registry == null) {
registry = ExtensionRegistry.newInstance();
for (RegisteredKeyVersion rkv : getRegisteredKeyVersions()) {
try {
rkv.registerProtoExtensions(registry);
} catch (ReflectiveOperationException ex) {
// Might get this if the proto is broken. Just print trace and
// continue.
// TODO(darylseah): Perhaps log this?
ex.printStackTrace();
}
}
registry = registry.getUnmodifiable();
cachedProtoExtensions = registry;
}
return registry;
}
}