Skip to content

Commit

Permalink
Issue #1011
Browse files Browse the repository at this point in the history
  • Loading branch information
pavel-stastny committed Oct 7, 2024
1 parent eb29be3 commit e5cfccb
Show file tree
Hide file tree
Showing 6 changed files with 110 additions and 47 deletions.
57 changes: 57 additions & 0 deletions rest/src/main/resources/openapi/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1390,6 +1390,63 @@ paths:
description: Volající není vlastník seznamu


# Informace o systému
/folders/{uuid}/items:
put:
tags:
- Uživatelské seznamy
summary: Přidání/obrání položek v uživatelském seznamu
description: Přidání/obrání položek v uživatelském seznamu
operationId: updateFolderItems
parameters:
- name: uuid
in: path
required: true
description: Jedinečný identifikátor seznamu
schema:
type: string
example: "b5d56622-8d1f-417f-a667-07bcf9547621"
requestBody:
description: Aktualizovaný obsah seznamu, včetně názvu a seznamu uživatelů.
required: true
content:
application/json:
schema:
type: object
properties:
items:
type: array
items:
type: string
example: "uuid:7aebc9bf-b139-436d-a638-d47c745edf76"
responses:
'200':
description: Úspěšně přidány a odebrány položky ze seznamu.
content:
application/json:
schema:
type: string
example: {
"name": "NovySeznam",
"uuid": "b5d56622-8d1f-417f-a667-07bcf9547621",
"itemsCount": 1,
"items":[
"uuid:7aebc9bf-b139-436d-a638-d47c745edf76"
],
"users": [
[
{
"createdAt": "2024-08-21 11:04:22.421",
"userRole": "owner",
"userId": "[email protected]"
}
]
],
"updatedAt": "2024-08-21 11:04:22.421"
}
'401':
description: Nepřihlášený uživatel

# Exkluzivni zamky
/locks/{hash}:
get:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void run() {
}

} catch (Throwable e) {
this.gcScheduler.shutdown();
//this.gcScheduler.shutdown();
LOGGER.log(Level.SEVERE, e.getMessage(), e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public NextSchedulerTask(LRProcessManager lrProcessManager, DefinitionManager de
@Override
public void run() {
try {
LOGGER.fine("Scheduling next task");
definitionManager.load();
List<LRProcess> plannedProcess = lrProcessManager.getPlannedProcess(allowRunningProcesses());
if (!plannedProcess.isEmpty() && this.processScheduler.getApplicationLib() != null /* initalized */) {
Expand All @@ -40,13 +41,13 @@ public void run() {
lrProcess.startMe(false, this.processScheduler.getApplicationLib(),
this.processScheduler.getAdditionalJarFiles());
} else {
LOGGER.fine("the maximum number of running processes is reached");
LOGGER.fine("The maximum number of running processes is reached");
}
} else {
if (this.processScheduler.getApplicationLib() == null) {
LOGGER.fine("scheduler is not initialized");
LOGGER.fine("Scheduler is not initialized");
} else {
LOGGER.fine("no planned process found ");
LOGGER.fine("No planned process found");
}
}
this.processScheduler.scheduleNextTask();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public class Kramerius4ConnectionProvider implements Provider<Connection> {
private static DataSource dataSource = createDataSource();

private static DataSource createDataSource() {


HikariDataSource ds = new HikariDataSource();
ds.setDriverClassName("org.postgresql.Driver");
ds.setJdbcUrl(KConfiguration.getInstance().getJdbcUrl());
Expand All @@ -29,7 +31,10 @@ private static DataSource createDataSource() {
ds.setLeakDetectionThreshold(KConfiguration.getInstance().getConfiguration().getInt("jdbcLeakDetectionThreshold"));
ds.setMaximumPoolSize(KConfiguration.getInstance().getConfiguration().getInt("jdbcMaximumPoolSize"));
ds.setConnectionTimeout(KConfiguration.getInstance().getConfiguration().getInt("jdbcConnectionTimeout"));
ds.addDataSourceProperty("socketTimeout", "30");

int datasourceSocketTimeout = KConfiguration.getInstance().getConfiguration().getInt("datasourceSocketTimeout",30);
ds.addDataSourceProperty("socketTimeout", datasourceSocketTimeout);

ds.setKeepaliveTime(120000);
return ds;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,45 +16,45 @@

public class GCSchedulerImpl implements GCScheduler {

public static Logger LOGGER = Logger.getLogger(GCScheduler.class.getName());
private LRProcessManager lrProcessManager;
private DefinitionManager definitionManager;
private int interval;
private Timer timer;
@Inject
public GCSchedulerImpl(LRProcessManager lrProcessManager,
DefinitionManager definitionManager) {
super();
this.lrProcessManager = lrProcessManager;
this.definitionManager = definitionManager;
this.timer = new Timer(GCSchedulerImpl.class.getName()+"-thread",/*true*/ false);
}

@Override
public void init() {
String sinterval = KConfiguration.getInstance().getProperty("gcScheduler.checkInterval","10000");
this.interval = Integer.parseInt(sinterval);
//this.scheduleFindGCCandidates();
}

@Override
public void scheduleFindGCCandidates() {
GCFindCandiatesTask findCandidates = new GCFindCandiatesTask(this.lrProcessManager, this.definitionManager, this, this.interval);
this.timer.schedule(findCandidates, this.interval);
}

@Override
public void scheduleCheckFoundGCCandidates(List<String> procUuids) {
GCCheckFoundCandidatesTask checkCandidates = new GCCheckFoundCandidatesTask(lrProcessManager, this, procUuids, this.interval);
this.timer.schedule(checkCandidates, this.interval);
}
public void shutdown() {
LOGGER.info("canceling gcscheduler");
this.timer.cancel();
}
public static Logger LOGGER = Logger.getLogger(GCScheduler.class.getName());

private LRProcessManager lrProcessManager;
private DefinitionManager definitionManager;

private int interval;
private Timer timer;

@Inject
public GCSchedulerImpl(LRProcessManager lrProcessManager, DefinitionManager definitionManager) {
super();
this.lrProcessManager = lrProcessManager;
this.definitionManager = definitionManager;
this.timer = new Timer(GCSchedulerImpl.class.getName() + "-thread", /* true */ false);
}

@Override
public void init() {
String sinterval = KConfiguration.getInstance().getProperty("gcScheduler.checkInterval", "10000");
this.interval = Integer.parseInt(sinterval);
// this.scheduleFindGCCandidates();
}

@Override
public void scheduleFindGCCandidates() {
GCFindCandiatesTask findCandidates = new GCFindCandiatesTask(this.lrProcessManager, this.definitionManager,
this, this.interval);
this.timer.schedule(findCandidates, this.interval);
}

@Override
public void scheduleCheckFoundGCCandidates(List<String> procUuids) {
GCCheckFoundCandidatesTask checkCandidates = new GCCheckFoundCandidatesTask(lrProcessManager, this, procUuids,
this.interval);
this.timer.schedule(checkCandidates, this.interval);
}

public void shutdown() {
LOGGER.info("Canceling gcscheduler");
this.timer.cancel();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public String[] getAdditionalJarFiles() {

@Override
public void shutdown() {
LOGGER.info("canceling process scheduler");
LOGGER.info("Canceling process scheduler");
this.timer.cancel();
}
}

0 comments on commit e5cfccb

Please sign in to comment.