@@ -13,6 +13,7 @@ import org.apache.http.HttpEntityEnclosingRequest; | |||||
import org.apache.http.HttpResponse; | import org.apache.http.HttpResponse; | ||||
import org.apache.http.client.HttpClient; | import org.apache.http.client.HttpClient; | ||||
import org.apache.http.client.methods.HttpRequestBase; | import org.apache.http.client.methods.HttpRequestBase; | ||||
import org.apache.http.conn.ConnectTimeoutException; | |||||
import org.apache.http.entity.ContentType; | import org.apache.http.entity.ContentType; | ||||
import org.cobbzilla.util.http.ApiConnectionInfo; | import org.cobbzilla.util.http.ApiConnectionInfo; | ||||
import org.cobbzilla.util.http.HttpRequestBean; | import org.cobbzilla.util.http.HttpRequestBean; | ||||
@@ -20,6 +21,8 @@ import org.cobbzilla.wizard.server.config.HttpConfiguration; | |||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.io.InputStream; | import java.io.InputStream; | ||||
import java.net.ConnectException; | |||||
import java.net.UnknownHostException; | |||||
import java.util.HashMap; | import java.util.HashMap; | ||||
import java.util.List; | import java.util.List; | ||||
import java.util.Map; | import java.util.Map; | ||||
@@ -102,8 +105,12 @@ public class BubbleNodeClient extends BubbleApiClient { | |||||
try { | try { | ||||
log.debug("execute: attempting request..."); | log.debug("execute: attempting request..."); | ||||
return super.execute(client, request); | return super.execute(client, request); | ||||
} catch (ConnectException | ConnectTimeoutException | UnknownHostException e) { | |||||
throw e; | |||||
} catch (Exception e) { | } catch (Exception e) { | ||||
return die("execute("+request+"): error: "+e); | |||||
throw new IllegalStateException("execute("+request+"): error: "+e, e); | |||||
} | } | ||||
} | } | ||||
@@ -33,7 +33,7 @@ public class NodeLauncher implements Runnable { | |||||
try { | try { | ||||
for (int i=0; i<LAUNCH_MAX_RETRIES; i++) { | for (int i=0; i<LAUNCH_MAX_RETRIES; i++) { | ||||
if (i > 0 && !launchMonitor.isRegistered(networkUuid)) { | if (i > 0 && !launchMonitor.isRegistered(networkUuid)) { | ||||
die("NodeLauncher.run: no longer registered: "+networkUuid); | |||||
throw new IllegalStateException("NodeLauncher.run: no longer registered: "+networkUuid); | |||||
} | } | ||||
if (!lock.get().equals(newNodeRequest.getLock())) { | if (!lock.get().equals(newNodeRequest.getLock())) { | ||||
die("NodeLauncher.run: existingLock (" + lock.get() + ") is different than lock in NewNodeNotification: " + newNodeRequest.getLock()); | die("NodeLauncher.run: existingLock (" + lock.get() + ") is different than lock in NewNodeNotification: " + newNodeRequest.getLock()); | ||||
@@ -22,10 +22,10 @@ import static org.cobbzilla.util.json.JsonUtil.json; | |||||
@AllArgsConstructor @Slf4j | @AllArgsConstructor @Slf4j | ||||
public class NotificationInboxProcessor implements Runnable { | public class NotificationInboxProcessor implements Runnable { | ||||
private ReceivedNotification n; | |||||
private Map<String, SynchronousNotification> syncRequests; | |||||
private BubbleConfiguration configuration; | |||||
private ReceivedNotificationDAO receivedNotificationDAO; | |||||
private final ReceivedNotification n; | |||||
private final Map<String, SynchronousNotification> syncRequests; | |||||
private final BubbleConfiguration configuration; | |||||
private final ReceivedNotificationDAO receivedNotificationDAO; | |||||
@Override public void run() { | @Override public void run() { | ||||
try { | try { | ||||
@@ -23,6 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired; | |||||
import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
import java.net.ConnectException; | import java.net.ConnectException; | ||||
import java.net.UnknownHostException; | |||||
import java.util.List; | import java.util.List; | ||||
import java.util.Map; | import java.util.Map; | ||||
@@ -122,17 +123,17 @@ public class NotificationService { | |||||
log.debug("_notify: <<<<< RECEIPT <<<<<< " + json(receipt, COMPACT_MAPPER) + " <<<<<<<<<<<<<<<<<<"); | log.debug("_notify: <<<<< RECEIPT <<<<<< " + json(receipt, COMPACT_MAPPER) + " <<<<<<<<<<<<<<<<<<"); | ||||
return receipt; | return receipt; | ||||
} catch (ConnectException | ConnectTimeoutException | ApiException e) { | |||||
} catch (ConnectException | ConnectTimeoutException | UnknownHostException | ApiException e) { | |||||
notification.setStatus(NotificationSendStatus.error); | notification.setStatus(NotificationSendStatus.error); | ||||
notification.setException(e); | notification.setException(e); | ||||
sentNotificationDAO.update(notification); | sentNotificationDAO.update(notification); | ||||
return die("_notify: " + e); | |||||
throw new IllegalStateException("_notify: "+shortError(e), e); | |||||
} catch (Exception e) { | } catch (Exception e) { | ||||
notification.setStatus(NotificationSendStatus.error); | notification.setStatus(NotificationSendStatus.error); | ||||
notification.setException(e); | notification.setException(e); | ||||
sentNotificationDAO.update(notification); | sentNotificationDAO.update(notification); | ||||
return die("_notify: " + e, e); | |||||
return die("_notify: "+shortError(e), e); | |||||
} | } | ||||
} | } | ||||
} | } | ||||