use of com.google.gerrit.extensions.registration.RegistrationHandle in project gerrit by GerritCodeReview.
the class LfsPluginServlet method install.
private void install(Plugin plugin) {
if (!plugin.getName().equals(pluginName)) {
return;
}
final GuiceFilter guiceFilter = load(plugin);
plugin.add(new RegistrationHandle() {
@Override
public void remove() {
filter.compareAndSet(guiceFilter, null);
}
});
filter.set(guiceFilter);
}
use of com.google.gerrit.extensions.registration.RegistrationHandle in project gerrit by GerritCodeReview.
the class LfsPluginServlet method load.
private GuiceFilter load(Plugin plugin) {
if (plugin.getHttpInjector() != null) {
final String name = plugin.getName();
final GuiceFilter guiceFilter;
try {
guiceFilter = plugin.getHttpInjector().getInstance(GuiceFilter.class);
} catch (RuntimeException e) {
log.warn(String.format("Plugin %s cannot load GuiceFilter", name), e);
return null;
}
try {
ServletContext ctx = PluginServletContext.create(plugin, "/");
guiceFilter.init(new WrappedFilterConfig(ctx));
} catch (ServletException e) {
log.warn(String.format("Plugin %s failed to initialize HTTP", name), e);
return null;
}
plugin.add(new RegistrationHandle() {
@Override
public void remove() {
guiceFilter.destroy();
}
});
return guiceFilter;
}
return null;
}
use of com.google.gerrit.extensions.registration.RegistrationHandle in project gerrit by GerritCodeReview.
the class PluginMetricMaker method newTrigger.
@Override
public RegistrationHandle newTrigger(Set<CallbackMetric<?>> metrics, Runnable trigger) {
final RegistrationHandle handle = root.newTrigger(metrics, trigger);
cleanup.add(handle);
return new RegistrationHandle() {
@Override
public void remove() {
handle.remove();
cleanup.remove(handle);
}
};
}
Aggregations