mirror of https://github.com/reiseburo/whoas
Rewrite HookRequest in Java
This commit is contained in:
parent
67af6a1a25
commit
a79048c9e8
|
@ -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
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue