admin setting for background thread count

This commit is contained in:
Athou
2013-04-12 09:56:57 +02:00
parent 7cc7fd9daa
commit 38c58fcf64
3 changed files with 23 additions and 6 deletions

View File

@@ -23,7 +23,6 @@ import com.commafeed.backend.model.FeedCategory;
import com.commafeed.backend.model.FeedSubscription;
import com.commafeed.backend.model.User;
import com.commafeed.backend.model.UserRole.Role;
import com.commafeed.backend.services.PasswordEncryptionService;
import com.commafeed.backend.services.UserService;
@Startup
@@ -48,9 +47,6 @@ public class StartupBean {
@Inject
UserService userService;
@Inject
PasswordEncryptionService encryptionService;
@Inject
ApplicationSettingsDAO applicationSettingsDAO;
@@ -66,8 +62,8 @@ public class StartupBean {
initialData();
}
// 3 threads
for (int i = 0; i < 6; i++) {
ApplicationSettings settings = applicationSettingsDAO.get();
for (int i = 0; i < settings.getBackgroundThreads(); i++) {
worker.start();
}

View File

@@ -12,6 +12,7 @@ public class ApplicationSettings extends AbstractModel {
private boolean allowRegistrations = false;
private String googleClientId;
private String googleClientSecret;
private int backgroundThreads = 3;
public String getPublicUrl() {
return publicUrl;
@@ -45,4 +46,12 @@ public class ApplicationSettings extends AbstractModel {
this.googleClientSecret = googleClientSecret;
}
public int getBackgroundThreads() {
return backgroundThreads;
}
public void setBackgroundThreads(int backgroundThreads) {
this.backgroundThreads = backgroundThreads;
}
}