@Override
public int handleCommand(final Namespace ns, final Manager m) {
- boolean inJson = ns.get("output") == OutputType.JSON || ns.getBoolean("json");
+ var inJson = ns.get("output") == OutputType.JSON || ns.getBoolean("json");
// TODO delete later when "json" variable is removed
if (ns.getBoolean("json")) {
busType = DBusConnection.DBusBusType.SESSION;
}
- try (DBusConnection conn = DBusConnection.getConnection(busType)) {
- String objectPath = DbusConfig.getObjectPath();
- Thread t = run(conn, objectPath, m, ignoreAttachments, inJson);
+ try (var conn = DBusConnection.getConnection(busType)) {
+ var objectPath = DbusConfig.getObjectPath();
+ var t = run(conn, objectPath, m, ignoreAttachments, inJson);
conn.requestBusName(DbusConfig.getBusname());
@Override
public int handleCommand(final Namespace ns, final List<Manager> managers) {
- boolean inJson = ns.get("output") == OutputType.JSON || ns.getBoolean("json");
+ var inJson = ns.get("output") == OutputType.JSON || ns.getBoolean("json");
// TODO delete later when "json" variable is removed
if (ns.getBoolean("json")) {
busType = DBusConnection.DBusBusType.SESSION;
}
- try (DBusConnection conn = DBusConnection.getConnection(busType)) {
- List<Thread> receiveThreads = new ArrayList<>();
- for (Manager m : managers) {
- String objectPath = DbusConfig.getObjectPath(m.getUsername());
- Thread thread = run(conn, objectPath, m, ignoreAttachments, inJson);
+ try (var conn = DBusConnection.getConnection(busType)) {
+ var receiveThreads = new ArrayList<Thread>();
+ for (var m : managers) {
+ var objectPath = DbusConfig.getObjectPath(m.getUsername());
+ var thread = run(conn, objectPath, m, ignoreAttachments, inJson);
receiveThreads.add(thread);
}
conn.requestBusName(DbusConfig.getBusname());
- for (Thread t : receiveThreads) {
+ for (var t : receiveThreads) {
try {
t.join();
} catch (InterruptedException ignored) {
) throws DBusException {
conn.exportObject(objectPath, new DbusSignalImpl(m));
- final Thread thread = new Thread(() -> {
+ final var thread = new Thread(() -> {
while (true) {
try {
m.receiveMessages(1,