Skip to content

Commit

Permalink
Add missing override annotations (#164)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisvest committed Jun 2, 2024
2 parents 95ae482 + 9328b48 commit f1a02ac
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/main/java/stormpot/BSlot.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ final class BSlot<T extends Poolable>
// threads observe the pointer to this object.
super(DEAD, live, poisonedSlots);
}


@Override
public void release(Poolable obj) {
if (poison == BlazePool.EXPLICIT_EXPIRE_POISON) {
poisonedSlots.getAndIncrement();
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/stormpot/LatchCompletion.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ final class LatchCompletion implements Completion {
LatchCompletion(CountDownLatch completionLatch) {
this.completionLatch = completionLatch;
}


@Override
public boolean await(Timeout timeout) throws InterruptedException {
Objects.requireNonNull(timeout, "Timeout cannot be null.");
return completionLatch.await(timeout.getTimeout(), timeout.getUnit());
Expand Down
1 change: 1 addition & 0 deletions src/test/java/blackbox/slow/DefaultPoolIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import stormpot.PoolBuilder;

class DefaultPoolIT extends ThreadBasedPoolIT {
@Override
protected PoolBuilder<GenericPoolable> createPoolBuilder(AlloKit.CountingAllocator allocator) {
return Pool.from(allocator);
}
Expand Down
2 changes: 2 additions & 0 deletions src/test/java/docs/MyAllocator.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@
import stormpot.Slot;

public class MyAllocator implements Allocator<MyPoolable> {
@Override
public MyPoolable allocate(Slot slot) throws Exception {
return new MyPoolable(slot);
}

@Override
public void deallocate(MyPoolable poolable) throws Exception {
// Nothing to do here
// But it's a perfect place to close sockets, files, etc.
Expand Down
6 changes: 4 additions & 2 deletions src/test/java/examples/DaoPoolExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
import java.sql.Statement;
import java.util.concurrent.TimeUnit;

@SuppressWarnings({"WeakerAccess","unused",
"SynchronizationOnLocalVariableOrMethodParameter"})
@SuppressWarnings({"WeakerAccess","unused"})
// tag::defineClass[]
public class DaoPoolExample {
// end::defineClass[]
Expand All @@ -46,6 +45,7 @@ private MyDao(Slot slot, Connection connection) {
}
// end::mydaoStart[]
// tag::mydaoRelease[]
@Override
public void release() {
slot.release(this);
}
Expand Down Expand Up @@ -79,6 +79,7 @@ public MyDaoAllocator(DataSource dataSource) {
// end::allocatorStart[]

// tag::allocatorAllocate[]
@Override
public MyDao allocate(Slot slot) throws Exception {
synchronized (dataSource) {
return new MyDao(slot, dataSource.getConnection());
Expand All @@ -87,6 +88,7 @@ public MyDao allocate(Slot slot) throws Exception {
// end::allocatorAllocate[]

// tag::allocatorClose[]
@Override
public void deallocate(MyDao poolable) throws Exception {
poolable.close();
}
Expand Down
1 change: 1 addition & 0 deletions src/test/java/examples/Examples.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ public GenericPoolable(Slot slot) {
this.slot = slot;
}

@Override
public void release() {
slot.release(this);
}
Expand Down
1 change: 1 addition & 0 deletions src/test/java/stormpot/GenericPoolable.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public GenericPoolable(Slot slot) {
super(slot);
}

@Override
public void release() {
lastReleaseBy = Thread.currentThread();
super.release();
Expand Down

0 comments on commit f1a02ac

Please sign in to comment.