Minor edits.
This commit is contained in:
parent
deb06723ee
commit
19f435a75c
3 changed files with 14 additions and 13 deletions
|
|
@ -80,11 +80,12 @@ public class Manager extends Component {
|
||||||
*/
|
*/
|
||||||
@Handler(priority = -1000)
|
@Handler(priority = -1000)
|
||||||
public void onStop(Stop event) {
|
public void onStop(Stop event) {
|
||||||
logger.fine(() -> "Applictaion stopped.");
|
logger.fine(() -> "Application stopped.");
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
try {
|
try {
|
||||||
|
// Get logging properties from file and put them in effect
|
||||||
InputStream props;
|
InputStream props;
|
||||||
var path = FsdUtils.findConfigFile(VM_OP_NAME.replace("-", ""),
|
var path = FsdUtils.findConfigFile(VM_OP_NAME.replace("-", ""),
|
||||||
"logging.properties");
|
"logging.properties");
|
||||||
|
|
@ -109,34 +110,35 @@ public class Manager extends Component {
|
||||||
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
|
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
try {
|
try {
|
||||||
Logger.getLogger(Manager.class.getName())
|
Logger.getLogger(Manager.class.getName()).fine(() -> "Version: "
|
||||||
.fine(() -> "Version: "
|
+ Manager.class.getPackage().getImplementationVersion());
|
||||||
+ Manager.class.getPackage().getImplementationVersion());
|
|
||||||
|
// Parse the command line arguments
|
||||||
CommandLineParser parser = new DefaultParser();
|
CommandLineParser parser = new DefaultParser();
|
||||||
// parse the command line arguments
|
|
||||||
final Options options = new Options();
|
final Options options = new Options();
|
||||||
options.addOption(new Option("c", "config", true, "The configura"
|
options.addOption(new Option("c", "config", true, "The configura"
|
||||||
+ "tion file (defaults to /etc/opt/vmoperator/config.yaml)."));
|
+ "tion file (defaults to /etc/opt/vmoperator/config.yaml)."));
|
||||||
CommandLine cmd = parser.parse(options, args);
|
CommandLine cmd = parser.parse(options, args);
|
||||||
// The Operator is the root component
|
|
||||||
|
// The Manager is the root component
|
||||||
app = new Manager(cmd);
|
app = new Manager(cmd);
|
||||||
|
|
||||||
// Prepare Stop
|
// Prepare Stop
|
||||||
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
|
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
|
||||||
try {
|
try {
|
||||||
app.fire(new Stop(), Channel.BROADCAST);
|
app.fire(new Stop());
|
||||||
Components.awaitExhaustion();
|
Components.awaitExhaustion();
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
// Cannot do anything about this.
|
// Cannot do anything about this.
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// Start application
|
// Start the application
|
||||||
Components.start(app);
|
Components.start(app);
|
||||||
} catch (IOException | InterruptedException
|
} catch (IOException | InterruptedException
|
||||||
| org.apache.commons.cli.ParseException e) {
|
| org.apache.commons.cli.ParseException e) {
|
||||||
Logger.getLogger(Manager.class.getName()).log(Level.SEVERE, e,
|
Logger.getLogger(Manager.class.getName()).log(Level.SEVERE, e,
|
||||||
() -> "Failed to start runner: " + e.getMessage());
|
() -> "Failed to start manager: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ import java.util.logging.Logger;
|
||||||
import org.jdrupes.vmoperator.manager.VmDefChanged.Type;
|
import org.jdrupes.vmoperator.manager.VmDefChanged.Type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delegee for reconciling the pod.
|
* Delegee for reconciling the stateful set (effectively the pod).
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("PMD.DataflowAnomalyAnalysis")
|
@SuppressWarnings("PMD.DataflowAnomalyAnalysis")
|
||||||
/* default */ class StsReconciler {
|
/* default */ class StsReconciler {
|
||||||
|
|
|
||||||
|
|
@ -61,8 +61,7 @@ public class VmWatcher extends Component {
|
||||||
|
|
||||||
private ApiClient client;
|
private ApiClient client;
|
||||||
private String namespaceToWatch;
|
private String namespaceToWatch;
|
||||||
private final Map<String, VmChannel> channels
|
private final Map<String, VmChannel> channels = new ConcurrentHashMap<>();
|
||||||
= new ConcurrentHashMap<>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new VM definition watcher.
|
* Instantiates a new VM definition watcher.
|
||||||
|
|
@ -74,7 +73,7 @@ public class VmWatcher extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* On configuration update.
|
* Configure the component.
|
||||||
*
|
*
|
||||||
* @param event the event
|
* @param event the event
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue