Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing override annotations #164

Merged
merged 1 commit into from
Jun 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading