Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Harmandeep Singh committed Sep 30, 2020
1 parent c781a09 commit 129a304
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
3 changes: 0 additions & 3 deletions rubix-spi/src/main/java/com/qubole/rubix/spi/CacheConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@
*/
package com.qubole.rubix.spi;

import com.google.common.collect.ImmutableList;
import org.apache.hadoop.conf.Configuration;

import java.util.List;

import static com.qubole.rubix.spi.utils.DataSizeUnits.MEGABYTES;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ public Poolable<T> borrowObject(String host)
log.debug(this.name + " : Borrowing object for partition: " + host);
for (int i = 0; i < 3; i++) { // try at most three times
Poolable<T> result = getObject(host);
if (factory.validate(result.getObject())) {
if (result == null) {
continue;
}
else if (factory.validate(result.getObject())) {
return result;
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ public boolean decreaseObject(Poolable<T> obj)
this.host, obj.getHost());
log.debug("Decreasing pool size object: " + obj);
objectFactory.destroy(obj.getObject());
aliveObjectCount.decrementAndGet();
obj.destroy();
return true;
}
Expand All @@ -109,7 +110,8 @@ public Poolable<T> getObject()
takeSemaphore.tryAcquire(config.getMaxWaitMilliseconds(), TimeUnit.MILLISECONDS);
}
catch (InterruptedException e) {
throw new RuntimeException(e);
Thread.currentThread().interrupt();
return null;
}

try {
Expand Down

0 comments on commit 129a304

Please sign in to comment.