pingers.put(PingType.DNS, new DNSPinger());
while (true) {
- synchronized (this) {
- DomainPingConfiguration conf;
- while ((conf = toExecute.peek()) != null) {
- handle(conf);
- toExecute.remove();
+ try {
+ boolean worked = false;
+ synchronized (this) {
+ DomainPingConfiguration conf;
+ while ((conf = toExecute.peek()) != null) {
+ worked = true;
+ handle(conf);
+ toExecute.remove();
+ }
+ notifyAll();
}
- notifyAll();
- }
- GigiResultSet rs = searchNeededPings.executeQuery();
- while (rs.next()) {
- handle(DomainPingConfiguration.getById(rs.getInt("id")));
- }
- try {
- Thread.sleep(5000);
- } catch (InterruptedException e) {
+ GigiResultSet rs = searchNeededPings.executeQuery();
+ while (rs.next()) {
+ worked = true;
+ handle(DomainPingConfiguration.getById(rs.getInt("id")));
+ }
+ try {
+ if ( !worked) {
+ Thread.sleep(5000);
+ }
+ } catch (InterruptedException e) {
+ }
+ } catch (Throwable t) {
+ t.printStackTrace();
}
}
}
private String test(SocketChannel sch, String domain, User subject) {
try {
+ sch.socket().setSoTimeout(5000);
SSLContext sc = SSLContext.getInstance("SSL");
try {
TrustManagerFactory tmf = TrustManagerFactory.getInstance("X509");