summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2022-01-31 15:10:00 +0100
committerSimon Rettberg2022-01-31 15:10:00 +0100
commitf2310d81bb5bd9994cdcf0ed35060e3b9815fc7e (patch)
tree704727f556de6078a97773072e70f67fb91a45b6
parent[WakeOnLan] Add more status output (diff)
downloadtmlite-bwlp-f2310d81bb5bd9994cdcf0ed35060e3b9815fc7e.tar.gz
tmlite-bwlp-f2310d81bb5bd9994cdcf0ed35060e3b9815fc7e.tar.xz
tmlite-bwlp-f2310d81bb5bd9994cdcf0ed35060e3b9815fc7e.zip
[RemoteExec] Fix instantiating via parametrized constructor
-rw-r--r--src/main/java/org/openslx/satserver/util/WakeOnLanExecutor.java4
-rw-r--r--src/main/java/org/openslx/taskmanager/tasks/RemoteExec.java1
-rw-r--r--src/main/java/org/openslx/taskmanager/tasks/WakeOnLan.java16
3 files changed, 12 insertions, 9 deletions
diff --git a/src/main/java/org/openslx/satserver/util/WakeOnLanExecutor.java b/src/main/java/org/openslx/satserver/util/WakeOnLanExecutor.java
index 1ee2f81..45a03c2 100644
--- a/src/main/java/org/openslx/satserver/util/WakeOnLanExecutor.java
+++ b/src/main/java/org/openslx/satserver/util/WakeOnLanExecutor.java
@@ -61,7 +61,7 @@ public class WakeOnLanExecutor
* Send out a bunch of WOL packets to the given list of MAC addresses. Every packet will be
* directed to given ip, i.e. all destination MACs have to be in the same subnet.
*
- * @param log For adding log outout
+ * @param log For adding log output
* @param macs list of MAC addresses
* @param ip destination IP (broadcast or directed broadcast address)
* @param port destination port, usually 9
@@ -114,7 +114,7 @@ public class WakeOnLanExecutor
}
DatagramPacket dp = new DatagramPacket( buffer, buffer.length, destAddr, port );
sock.send( dp );
- log.addMsg( "Sent packet to " + mac );
+ //log.addMsg( "Sent packet to " + mac );
success.add( mac );
Thread.sleep( 10 );
} catch ( NumberFormatException e ) {
diff --git a/src/main/java/org/openslx/taskmanager/tasks/RemoteExec.java b/src/main/java/org/openslx/taskmanager/tasks/RemoteExec.java
index c533c27..cc7631d 100644
--- a/src/main/java/org/openslx/taskmanager/tasks/RemoteExec.java
+++ b/src/main/java/org/openslx/taskmanager/tasks/RemoteExec.java
@@ -62,6 +62,7 @@ public class RemoteExec extends AbstractTask
this.port = port;
this.command = command;
this.timeoutSeconds = timeoutSeconds;
+ initTask();
}
@Override
diff --git a/src/main/java/org/openslx/taskmanager/tasks/WakeOnLan.java b/src/main/java/org/openslx/taskmanager/tasks/WakeOnLan.java
index 2391d4d..17780b5 100644
--- a/src/main/java/org/openslx/taskmanager/tasks/WakeOnLan.java
+++ b/src/main/java/org/openslx/taskmanager/tasks/WakeOnLan.java
@@ -93,14 +93,17 @@ public class WakeOnLan extends AbstractTask
}
list.add( client.mac );
}
+ if ( byMethod.isEmpty() )
+ break;
+ status.addMsg( "Starting job distribution..." );
// Execute
List<Future<?>> waitList = new ArrayList<>();
for ( Entry<String, ArrayList<String>> it : byMethod.entrySet() ) {
- String[] parts = it.getKey().split( "//" );
- String method = parts[0];
- List<String> macs = it.getValue();
- String macString = Strings.join( macs.iterator(), ' ' );
- String ip = parts[1];
+ final String[] parts = it.getKey().split( "//" );
+ final String method = parts[0];
+ final List<String> macs = it.getValue();
+ final String macString = Strings.join( macs.iterator(), ' ' );
+ final String ip = parts[1];
final int jobId = ++jobIdCounter;
if ( method.equalsIgnoreCase( "DIRECT" ) ) {
// Directly from server
@@ -164,8 +167,7 @@ public class WakeOnLan extends AbstractTask
e.printStackTrace();
}
}
- // If we had any jobs to do, loop again, otherwise we're done
- } while ( !byMethod.isEmpty() );
+ } while ( true );
status.addMsg( "Mainloop done" );
if ( this.clients.isEmpty() )
return true;