*/
public void sendSchedulerRequest(String msg) throws Exception {
String _host = "";
int _port = 0;
DatagramSocket udpSocket = null;
try {
_host = sosString.parseToString(arguments, "scheduler_host");
if (sosString.parseToString(arguments, "scheduler_port").length() > 0)
_port = Integer.parseInt(sosString.parseToString(arguments, "scheduler_port"));
if (_host == null || _host.length() == 0)
throw (new Exception("Job Scheduler host name missing."));
if (_port == 0)
throw (new Exception("Job Scheduler port missing."));
udpSocket = new DatagramSocket();
udpSocket.connect(InetAddress.getByName(_host), _port);
// protocol=udp
if (msg.indexOf("<?xml") == -1) {
msg = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>" + msg + "\r\n";
}
getLogger().debug9("sending Job Scheduler message: " + msg);
byte[] commandBytes = msg.getBytes();
udpSocket.send(new DatagramPacket(commandBytes, commandBytes.length, InetAddress.getByName(_host), _port));
}
catch (Exception e) {
getLogger().warn("could not send message to the Job Scheduler, cause " + e.toString());
}
finally {
if (udpSocket != null)
udpSocket.disconnect();
}
}