Skip to content
Permalink
Browse files
Add timeout to Broker connection for notifications
Change-Id: Ic2803bdba15e6742a084a84d483996ab7ab45a8e
  • Loading branch information
sjaco002 committed Mar 16, 2018
1 parent 185b63d commit a7756f1036825653b02c9a9d8ed96758fe24dd34
Showing 1 changed file with 2 additions and 1 deletion.
@@ -106,14 +106,15 @@ public static void sendMessage(String targetURL, String urlParameters) {

connection.setUseCaches(false);
connection.setDoOutput(true);
connection.setConnectTimeout(500);

if (connection.getOutputStream() != null) {
//Send message
DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
wr.writeBytes(urlParameters);
wr.close();
} else {
LOGGER.log(Level.WARNING, "Channel Failed to connect to Broker.");
throw new Exception();
}

if (LOGGER.isLoggable(Level.INFO)) {

0 comments on commit a7756f1

Please sign in to comment.