public void handleCommand(
final Namespace ns, final Manager m, final OutputWriter outputWriter
) throws CommandException {
- boolean ignoreAttachments = ns.getBoolean("ignore-attachments");
+ boolean ignoreAttachments = Boolean.TRUE.equals(ns.getBoolean("ignore-attachments"));
DBusConnection.DBusBusType busType;
- if (ns.getBoolean("system")) {
+ if (Boolean.TRUE.equals(ns.getBoolean("system"))) {
busType = DBusConnection.DBusBusType.SYSTEM;
} else {
busType = DBusConnection.DBusBusType.SESSION;
var t = run(conn, objectPath, m, outputWriter, ignoreAttachments);
conn.requestBusName(DbusConfig.getBusname());
+ logger.info("DBus daemon running in single-user mode for " + m.getSelfNumber());
try {
t.join();
public void handleCommand(
final Namespace ns, final List<Manager> managers, final SignalCreator c, final OutputWriter outputWriter
) throws CommandException {
- boolean ignoreAttachments = ns.getBoolean("ignore-attachments");
+ boolean ignoreAttachments = Boolean.TRUE.equals(ns.getBoolean("ignore-attachments"));
DBusConnection.DBusBusType busType;
- if (ns.getBoolean("system")) {
+ if (Boolean.TRUE.equals(ns.getBoolean("system"))) {
busType = DBusConnection.DBusBusType.SYSTEM;
} else {
busType = DBusConnection.DBusBusType.SESSION;
}
conn.requestBusName(DbusConfig.getBusname());
+ logger.info("DBus daemon running in anonymous mode");
signalControl.run();
} catch (DBusException | IOException e) {
private Thread run(
DBusConnection conn, String objectPath, Manager m, OutputWriter outputWriter, boolean ignoreAttachments
) throws DBusException {
- conn.exportObject(new DbusSignalImpl(m, objectPath));
+ final var signal = new DbusSignalImpl(m, conn, objectPath);
+ conn.exportObject(signal);
+ final var initThread = new Thread(signal::initObjects);
+ initThread.start();
- logger.info("Exported dbus object: " + objectPath);
+ logger.debug("Exported dbus object: " + objectPath);
final var thread = new Thread(() -> {
while (!Thread.interrupted()) {
logger.warn("Receiving messages failed, retrying", e);
}
}
+ try {
+ initThread.join();
+ } catch (InterruptedException ignored) {
+ }
+ signal.close();
});
thread.start();