Skip to content

Commit 3bc479d

Browse files
committed
[1.1.0-SNAPSHOT]
Test fixed with correct address for ABI Debug logging removed PersonalQueue optimized
1 parent c7dd92e commit 3bc479d

File tree

3 files changed

+9
-19
lines changed

3 files changed

+9
-19
lines changed

src/main/java/io/api/etherscan/core/impl/BasicProvider.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,10 @@
77
import io.api.etherscan.error.RateLimitException;
88
import io.api.etherscan.executor.IHttpExecutor;
99
import io.api.etherscan.manager.IQueueManager;
10-
import io.api.etherscan.manager.impl.QueueManager;
1110
import io.api.etherscan.model.utility.StringResponseTO;
1211
import io.api.etherscan.util.BasicUtils;
1312

14-
import java.time.LocalTime;
1513
import java.util.Map;
16-
import java.util.logging.Level;
17-
import java.util.logging.Logger;
1814

1915
/**
2016
* Base provider for API Implementations
@@ -25,8 +21,6 @@
2521
*/
2622
abstract class BasicProvider {
2723

28-
private static final Logger logger = Logger.getLogger(QueueManager.class.getName());
29-
3024
static final int MAX_END_BLOCK = Integer.MAX_VALUE;
3125
static final int MIN_START_BLOCK = 0;
3226

@@ -76,9 +70,7 @@ <T> T convert(final String json, final Class<T> tClass) {
7670
}
7771

7872
String getRequest(final String urlParameters) {
79-
logger.log(Level.SEVERE, "ASKED - " + LocalTime.now());
8073
queue.takeTurn();
81-
logger.log(Level.SEVERE, "GRANTED - " + LocalTime.now());
8274
final String url = baseUrl + module + urlParameters;
8375
final String result = executor.get(url);
8476
if (BasicUtils.isEmpty(result))
@@ -88,9 +80,7 @@ String getRequest(final String urlParameters) {
8880
}
8981

9082
String postRequest(final String urlParameters, final String dataToPost) {
91-
logger.log(Level.SEVERE, "ASKED - " + LocalTime.now());
9283
queue.takeTurn();
93-
logger.log(Level.SEVERE, "GRANTED - " + LocalTime.now());
9484
final String url = baseUrl + module + urlParameters;
9585
return executor.post(url, dataToPost);
9686
}

src/main/java/io/api/etherscan/manager/impl/QueueManager.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import java.util.concurrent.*;
66

77
/**
8-
* Queue implementation With size and reset time as params
8+
* Queue Semaphore implementation with size and reset time as params
99
*
1010
* @see IQueueManager
1111
*
@@ -15,18 +15,18 @@
1515
public class QueueManager implements IQueueManager {
1616

1717
public static final QueueManager DEFAULT_KEY_QUEUE = new QueueManager(1, 7);
18-
public static final QueueManager PERSONAL_KEY_QUEUE = new QueueManager(5, 1);
18+
public static final QueueManager PERSONAL_KEY_QUEUE = new QueueManager(2, 1);
1919

2020
private final Semaphore semaphore;
2121

22-
public QueueManager(int queueSize, int queueResetTimeInSec) {
23-
this(queueSize, queueResetTimeInSec, queueResetTimeInSec);
22+
public QueueManager(int size, int resetInSec) {
23+
this(size, resetInSec, resetInSec);
2424
}
2525

26-
public QueueManager(int queueSize, int queueResetTimeInSec, int delayInSec) {
27-
this.semaphore = new Semaphore(queueSize);
26+
public QueueManager(int size, int resetInSec, int delayInSec) {
27+
this.semaphore = new Semaphore(size);
2828
Executors.newSingleThreadScheduledExecutor()
29-
.scheduleAtFixedRate(releaseLocks(queueSize), delayInSec, queueResetTimeInSec, TimeUnit.SECONDS);
29+
.scheduleAtFixedRate(releaseLocks(size), delayInSec, resetInSec, TimeUnit.SECONDS);
3030
}
3131

3232
@Override

src/test/java/io/api/etherscan/contract/ContractApiTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ public void invalidParamWithError() {
3434

3535
@Test
3636
public void correctParamWithEmptyExpectedResult() {
37-
Abi abi = getApi().contract().contractAbi("0xBB1bc244D798123fDe783fCc1C72d3Bb8C189413");
37+
Abi abi = getApi().contract().contractAbi("0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413");
3838
assertNotNull(abi);
39-
assertFalse(abi.isVerified());
39+
assertTrue(abi.isVerified());
4040
}
4141
}

0 commit comments

Comments
 (0)