Skip to content

Commit

Permalink
Merge branch '3.9' of https://github.com/JumpMind/symmetric-ds.git in…
Browse files Browse the repository at this point in the history
…to 3.9
  • Loading branch information
erilong committed Aug 8, 2019
2 parents 8d6d476 + 7e2bdb2 commit 5abdf4a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
Expand Up @@ -47,7 +47,7 @@
*/
public interface IDataService {

public void insertTableReloadRequest(TableReloadRequest request);
public void insertTableReloadRequest(ISqlTransaction transaction, TableReloadRequest request);

public TableReloadRequest getTableReloadRequest(TableReloadRequestKey key);

Expand Down
Expand Up @@ -236,15 +236,15 @@ protected void deleteTableReloadRequest(ISqlTransaction sqlTransaction,
Types.VARCHAR, Types.VARCHAR, Types.VARCHAR });
}

public void insertTableReloadRequest(TableReloadRequest request) {
public void insertTableReloadRequest(ISqlTransaction transaction, TableReloadRequest request) {
Date time = new Date();
request.setLastUpdateTime(time);
if (request.getCreateTime() == null) {
request.setCreateTime(time);
}
request.setCreateTime(new Date((request.getCreateTime().getTime() / 1000) * 1000));

sqlTemplate.update(
transaction.prepareAndExecute(
getSql("insertTableReloadRequest"),
new Object[] { request.getReloadSelect(), request.getBeforeCustomSql(),
request.getCreateTime(), request.getLastUpdateBy(),
Expand Down
Expand Up @@ -206,6 +206,26 @@ protected void execJava(boolean isConsole) {
restartDetected = false;
startProcess = true;
} else if (keepRunning) {
long tenminutesinms = 60 * 10 * 1000;
long twelveminutesinms = 60 * 12 * 1000;
long tensecondsinms = 10 * 1000;
long now = System.currentTimeMillis();
while(child.isAlive()) {
logger.log(Level.WARNING, "Server process has not stopped yet");
if(System.currentTimeMillis() - now > twelveminutesinms) {
logger.log(Level.SEVERE, "Server process never exited, exiting now");
child.destroyForcibly();
// If it has not exited by now, it probably never will.
break;
}
if(System.currentTimeMillis() - now > tenminutesinms) {
logger.log(Level.SEVERE, "Server process never exited, trying to force the exit of server process");
child.destroyForcibly();
}
try {
Thread.sleep(tensecondsinms);
} catch(InterruptedException e) { }
}
logger.log(Level.SEVERE, "Unexpected exit from server: " + child.exitValue());
long runTime = System.currentTimeMillis() - startTime;
if (System.currentTimeMillis() - startTime < 7000) {
Expand All @@ -225,7 +245,7 @@ protected void execJava(boolean isConsole) {
updateStatus(Status.STOPPED);
throw new WrapperException(Constants.RC_SERVER_EXITED, child.exitValue(), "Exception caught.");
} catch (Throwable ex2) {
ex.printStackTrace();
ex2.printStackTrace();
}
}
}
Expand Down

0 comments on commit 5abdf4a

Please sign in to comment.