From a79048c9e8e72c013797896440d7d365c852741a Mon Sep 17 00:00:00 2001 From: "R. Tyler Croy" Date: Fri, 3 Apr 2015 06:56:24 -0700 Subject: [PATCH] Rewrite HookRequest in Java --- .../github/lookout/whoas/HookRequest.groovy | 36 ------------------- .../com/github/lookout/whoas/HookRequest.java | 36 +++++++++++++++++++ .../com/github/lookout/whoas/Publisher.java | 2 +- 3 files changed, 37 insertions(+), 37 deletions(-) delete mode 100644 src/main/groovy/com/github/lookout/whoas/HookRequest.groovy create mode 100644 src/main/groovy/com/github/lookout/whoas/HookRequest.java diff --git a/src/main/groovy/com/github/lookout/whoas/HookRequest.groovy b/src/main/groovy/com/github/lookout/whoas/HookRequest.groovy deleted file mode 100644 index d29ac5e..0000000 --- a/src/main/groovy/com/github/lookout/whoas/HookRequest.groovy +++ /dev/null @@ -1,36 +0,0 @@ -package com.github.lookout.whoas - -import com.fasterxml.jackson.annotation.JsonProperty -import org.joda.time.DateTime - - -class HookRequest { - @JsonProperty - public Long retries - - @JsonProperty - public String url - - @JsonProperty - public String postData - - @JsonProperty - public DateTime deliverAfter - - @JsonProperty - public String contentType - - /** Constructor for Jackson */ - HookRequest() { } - - /** - * Default constructor for creating a simple HookRequest with a URL and the - * POST data to be delivered to that URL - */ - HookRequest(String hookUrl, String hookData, String contentType) { - this.retries = 0 - this.url = hookUrl - this.postData = hookData - this.contentType = contentType - } -} diff --git a/src/main/groovy/com/github/lookout/whoas/HookRequest.java b/src/main/groovy/com/github/lookout/whoas/HookRequest.java new file mode 100644 index 0000000..df5ca2f --- /dev/null +++ b/src/main/groovy/com/github/lookout/whoas/HookRequest.java @@ -0,0 +1,36 @@ +package com.github.lookout.whoas; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.joda.time.DateTime; + + +public class HookRequest { + @JsonProperty + public int retries; + + @JsonProperty + public String url; + + @JsonProperty + public String postData; + + @JsonProperty + public DateTime deliverAfter; + + @JsonProperty + public String contentType; + + /** Constructor for Jackson */ + public HookRequest() { } + + /** + * Default constructor for creating a simple HookRequest with a URL and the + * POST data to be delivered to that URL + */ + public HookRequest(String hookUrl, String hookData, String contentType) { + this.retries = 0; + this.url = hookUrl; + this.postData = hookData; + this.contentType = contentType; + } +} diff --git a/src/main/groovy/com/github/lookout/whoas/Publisher.java b/src/main/groovy/com/github/lookout/whoas/Publisher.java index 5fcb0ab..b81261a 100644 --- a/src/main/groovy/com/github/lookout/whoas/Publisher.java +++ b/src/main/groovy/com/github/lookout/whoas/Publisher.java @@ -90,7 +90,7 @@ public class Publisher { * Sleep the current thread the appropriate amount of time for the * attemptNumber */ - void backoffSleep(Long attemptNumber) throws InterruptedException { + void backoffSleep(int attemptNumber) throws InterruptedException { int naptime = (int)(Math.pow(DEFAULT_BACKOFF_MILLIS, attemptNumber)); if (naptime > DEFAULT_BACKOFF_MAX_MILLIS) { naptime = DEFAULT_BACKOFF_MAX_MILLIS;