mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
display app version
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package com.commafeed.backend;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import javax.ejb.Stateless;
|
||||
import javax.ejb.TransactionManagement;
|
||||
@@ -19,13 +18,15 @@ import liquibase.resource.ClassLoaderResourceAccessor;
|
||||
import liquibase.resource.ResourceAccessor;
|
||||
import liquibase.structure.DatabaseObject;
|
||||
|
||||
import com.commafeed.backend.services.ApplicationPropertiesService;
|
||||
|
||||
@Stateless
|
||||
@TransactionManagement(TransactionManagementType.BEAN)
|
||||
public class DatabaseUpdater {
|
||||
|
||||
public void update() {
|
||||
String datasourceName = ResourceBundle.getBundle("application")
|
||||
.getString("datasource");
|
||||
ApplicationPropertiesService properties = ApplicationPropertiesService.get();
|
||||
String datasourceName = properties.getDatasource();
|
||||
try {
|
||||
Context context = null;
|
||||
Connection connection = null;
|
||||
|
||||
@@ -72,7 +72,6 @@ public class FeedRefreshUpdater {
|
||||
public void init() {
|
||||
ApplicationSettings settings = applicationSettingsService.get();
|
||||
int threads = Math.max(settings.getDatabaseUpdateThreads(), 1);
|
||||
log.info("Creating database pool with {} threads", threads);
|
||||
pool = new FeedRefreshExecutor("feed-refresh-updater", threads, 500 * threads);
|
||||
locks = Striped.lazyWeakLock(threads * 100000);
|
||||
}
|
||||
|
||||
@@ -52,7 +52,6 @@ public class FeedRefreshWorker {
|
||||
private void init() {
|
||||
ApplicationSettings settings = applicationSettingsService.get();
|
||||
int threads = settings.getBackgroundThreads();
|
||||
log.info("Creating refresh worker pool with {} threads", threads);
|
||||
pool = new FeedRefreshExecutor("feed-refresh-worker", threads,
|
||||
20 * threads);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.commafeed.backend.services;
|
||||
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
public class ApplicationPropertiesService {
|
||||
|
||||
private ResourceBundle bundle;
|
||||
|
||||
private static ApplicationPropertiesService INSTANCE = new ApplicationPropertiesService();
|
||||
|
||||
public static ApplicationPropertiesService get() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
private ApplicationPropertiesService() {
|
||||
bundle = ResourceBundle.getBundle("application");
|
||||
}
|
||||
|
||||
public String getDatasource() {
|
||||
return bundle.getString("datasource");
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return bundle.getString("version");
|
||||
}
|
||||
|
||||
public String getGitCommit() {
|
||||
return bundle.getString("git.commit");
|
||||
}
|
||||
|
||||
public boolean isProduction() {
|
||||
return Boolean.valueOf(bundle.getString("production"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user