-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add detached mode for running H2 (DAT-17654) (#5929)
- Loading branch information
1 parent
c8edcf9
commit a4880f0
Showing
4 changed files
with
96 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
liquibase-standard/src/main/java/liquibase/command/core/StopH2CommandStep.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package liquibase.command.core; | ||
|
||
import liquibase.Scope; | ||
import liquibase.command.AbstractCommandStep; | ||
import liquibase.command.CommandDefinition; | ||
import liquibase.command.CommandResultsBuilder; | ||
|
||
import java.util.Iterator; | ||
|
||
public class StopH2CommandStep extends AbstractCommandStep { | ||
|
||
public static final String[] COMMAND_NAME = {"init", "stopH2"}; | ||
|
||
@Override | ||
public String[][] defineCommandNames() { | ||
return new String[][]{COMMAND_NAME}; | ||
} | ||
|
||
@Override | ||
public void adjustCommandDefinition(CommandDefinition commandDefinition) { | ||
super.adjustCommandDefinition(commandDefinition); | ||
commandDefinition.setHidden(true); | ||
} | ||
|
||
@Override | ||
public void run(CommandResultsBuilder resultsBuilder) throws Exception { | ||
for (Iterator<Thread> iterator = StartH2CommandStep.RUNNING_THREADS.iterator(); iterator.hasNext(); ) { | ||
Thread runningThread = iterator.next(); | ||
try { | ||
runningThread.interrupt(); | ||
iterator.remove(); | ||
} catch (Exception e) { | ||
Scope.getCurrentScope().getLog(getClass()).warning("Error stopping H2 thread", e); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters