Commit c8824f82 authored by Matija Obreza's avatar Matija Obreza

Deprecated updateAccessions(String, String)

parent df9d1936
......@@ -49,7 +49,6 @@ import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
// TODO: Auto-generated Javadoc
/**
* Genesys API client using Scribe.
*/
......@@ -67,7 +66,7 @@ public class GenesysClient {
/** The service. */
private OAuthService service;
/** GenesysTokens: access- and refreshToken. */
/** GenesysTokens: access- and refreshToken. */
private GenesysTokens tokens = new GenesysTokens();
/** The genesys api. */
......@@ -79,10 +78,10 @@ public class GenesysClient {
/** The api secret. */
private String apiSecret;
/** Socket connect timeout. */
/** Socket connect timeout. */
private int connectTimeout = 20;
/** Socket read timeout. */
/** Socket read timeout. */
private int readTimeout = 120;
static {
......@@ -438,7 +437,9 @@ public class GenesysClient {
* @throws InterruptedException when thread was interrupted during sleep
* between retries
*
* @deprecated Will be removed by 1.0.0 release
*/
@Deprecated
public String updateAccessions(String instCode, String jsonAccessionList) throws GenesysApiException,
InterruptedException {
for (int retry = 0; retry < 5; retry++) {
......@@ -470,7 +471,18 @@ public class GenesysClient {
return null;
}
return updateAccessions(instCode, objectMapper.writeValueAsString(accns));
String data=objectMapper.writeValueAsString(accns);
for (int retry = 0; retry < 5; retry++) {
try {
return query(Verb.PUT, "/acn/" + instCode + "/upsert", null, data);
} catch (PleaseRetryException e) {
long sleepTime = (long) (Math.pow(2, retry) * 100 + Math.pow(2, retry) * 2500 * Math.random());
_log.warn("Retrying PUT after " + sleepTime + " ms.");
Thread.sleep(sleepTime);
}
}
throw new RuntimeException("All retries failed");
}
/**
......
......@@ -33,7 +33,6 @@ import org.scribe.model.Response;
import org.scribe.model.Token;
import org.scribe.utils.OAuthEncoder;
// TODO: Auto-generated Javadoc
/**
* Genesys API v1.
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment