Rewrite HookRequest in Java

This commit is contained in:
R. Tyler Croy 2015-04-03 06:56:24 -07:00
parent 67af6a1a25
commit a79048c9e8
3 changed files with 37 additions and 37 deletions

View File

@ -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
}
}

View File

@ -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;
}
}

View File

@ -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;