Skip to content

Commit

Permalink
improve with rawtype
Browse files Browse the repository at this point in the history
  • Loading branch information
JacksonTian authored and yndu13 committed Jul 23, 2024
1 parent 10e858c commit e7ff956
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public synchronized static void put(final String key, Object data, int expire) {
ThrottlingPool.remove(key);
if (data != null) {
if (expire >= 0) {
Future future = executor.schedule(new Runnable() {
Future<?> future = executor.schedule(new Runnable() {
@Override
public void run() {
synchronized (ThrottlingPool.class) {
Expand Down Expand Up @@ -50,7 +50,7 @@ public synchronized static int getExpire(String key) {
public synchronized static Object remove(String key) {
Entity entity = map.remove(key);
if (entity == null) return null;
Future future = entity.getFuture();
Future<?> future = entity.getFuture();
if (future != null) future.cancel(true);
return entity.getValue();
}
Expand All @@ -62,7 +62,7 @@ public synchronized static int size() {
public synchronized static void clear() {
for (Entity entity : map.values()) {
if (entity != null) {
Future future = entity.getFuture();
Future<?> future = entity.getFuture();
if (future != null) future.cancel(true);
}
}
Expand All @@ -76,9 +76,9 @@ public synchronized static Map<String, Entity> getPool() {
private static class Entity {
private Object value;
private int expire;
private Future future;
private Future<?> future;

public Entity(Object value, int expire, Future future) {
public Entity(Object value, int expire, Future<?> future) {
this.value = value;
this.expire = expire;
this.future = future;
Expand All @@ -92,7 +92,7 @@ public int getExpire() {
return expire;
}

public Future getFuture() {
public Future<?> getFuture() {
return future;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void withFetcherTest() {
final String roleName = "roleName";
InstanceProfileCredentialsProvider provider = new InstanceProfileCredentialsProvider(roleName);
ECSMetadataServiceCredentialsFetcher fetcher = mock(ECSMetadataServiceCredentialsFetcher.class);
doAnswer(new Answer() {
doAnswer(new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocationOnMock) {
String roleNameAgru = invocationOnMock.getArgument(0, String.class);
Expand Down

0 comments on commit e7ff956

Please sign in to comment.