use of jakarta.annotation.PostConstruct in project spring-batch by spring-projects.
the class PrometheusConfiguration method init.
@PostConstruct
public void init() {
pushGateway = new PushGateway(prometheusPushGatewayUrl);
groupingKey.put(prometheusGroupingKey, prometheusJobName);
PrometheusMeterRegistry prometheusMeterRegistry = new PrometheusMeterRegistry(PrometheusConfig.DEFAULT);
collectorRegistry = prometheusMeterRegistry.getPrometheusRegistry();
Metrics.globalRegistry.add(prometheusMeterRegistry);
}
use of jakarta.annotation.PostConstruct in project helidon by oracle.
the class MpTracingFilter method postConstruct.
/**
* Post construct method, initialization procedures.
*/
@PostConstruct
public void postConstruct() {
this.utils = MpTracingHelper.create();
// use skip pattern first
Config config = ConfigProvider.getConfig();
Optional<String> skipPattern = config.getOptionalValue("mp.opentracing.server.skip-pattern", String.class);
this.skipPatternFunction = skipPattern.map(Pattern::compile).map(pattern -> (Function<String, Boolean>) path -> pattern.matcher(path).matches()).orElse(path -> false);
}
use of jakarta.annotation.PostConstruct in project OpenGrok by OpenGrok.
the class IncomingFilter method init.
@PostConstruct
public void init() {
try {
localAddresses.add(InetAddress.getLocalHost().getHostAddress());
for (InetAddress inetAddress : InetAddress.getAllByName("localhost")) {
localAddresses.add(inetAddress.getHostAddress());
}
} catch (IOException e) {
LOGGER.log(Level.SEVERE, "Could not get localhost addresses", e);
}
// Cache the tokens to avoid locking.
setTokens(RuntimeEnvironment.getInstance().getAuthenticationTokens());
RuntimeEnvironment.getInstance().registerListener(this);
}
use of jakarta.annotation.PostConstruct in project rubia-forums by flashboss.
the class ViewMyForumsMain method execute.
/**
*/
@PostConstruct
public void execute() {
try {
super.execute();
Collection<ForumBean> forums = getWatchedForums();
Date userLastLogin = getUserLastLoginDate(userModule, userProfileModule);
for (ForumBean currentForum : forums) {
// setup folderLook based on whats specified in the theme
String folderImage = themeHelper.getResourceForumURL();
// bundle key
String folderAlt = "No_new_posts";
if (forumsLastPosts != null && forumsLastPosts.containsKey(currentForum.getId())) {
PostBean lastPost = forumsLastPosts.get(currentForum.getId());
Date lastPostDate = lastPost.getCreateDate();
if (lastPostDate != null && userLastLogin != null && lastPostDate.compareTo(userLastLogin) > 0) {
// bundle key
folderAlt = "New_posts";
folderImage = themeHelper.getResourceForumNewURL();
}
}
if (currentForum.getStatus() == Constants.FORUM_LOCKED) {
folderImage = themeHelper.getResourceForumLockedURL();
// bundle key
folderAlt = "Forum_locked";
}
getForumImages().put(currentForum.getId(), folderImage);
getForumImageDescriptions().put(currentForum.getId(), folderAlt);
}
} catch (Exception e) {
log.error(e);
}
}
use of jakarta.annotation.PostConstruct in project rubia-forums by flashboss.
the class ViewTopic method execute.
/**
* This method gets topicId from parameters and tries to find topic with that
* id.
*/
@PostConstruct
public void execute() {
// parse input data
int topicId = -1;
Integer postId = -1;
String t = getParameter(p_topicId);
String p = getParameter(p_postId);
if (t != null && t.trim().length() > 0) {
topicId = parseInt(t);
}
try {
if (p != null && p.trim().length() > 0) {
postId = parseInt(p);
PostBean post = forumsModule.findPostById(postId);
topicId = post.getTopic().getId().intValue();
topic = post.getTopic();
}
refreshTopic(topicId);
} catch (Exception e) {
log.error(e);
}
}
Aggregations