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

Balder/avoid java21 this escape warning 16 #32263

Merged
merged 2 commits into from
Aug 26, 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
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
public abstract class RedirectedAsyncOperation<S, T> implements AsyncOperation<T> {

protected final AsyncOperation<S> source;
private final AsyncOperationListenImpl<T> listenImpl;
private AsyncOperationListenImpl<T> listenImpl;

public RedirectedAsyncOperation(AsyncOperation<S> source) {
this.source = source;
}

void listen() {
this.listenImpl = new AsyncOperationListenImpl<>(this);
source.register(new AsyncCallback<S>() {
@Override
public void done(AsyncOperation<S> op) { notifyDone(); }
});
source.register(op -> notifyDone());
}

private void notifyDone() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;

public class JsonHttpResult extends HttpResult {
public final class JsonHttpResult extends HttpResult {

private static final ObjectMapper mapper = new ObjectMapper();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,13 @@ public void done(AsyncOperation<String> op) {
void testRedirectedOperation() {
{
final AsyncOperationImpl<String> op = new AsyncOperationImpl<>("test", "desc");
AsyncOperation<Integer> deleteRequest = new RedirectedAsyncOperation<String, Integer>(op) {
var deleteRequest = new RedirectedAsyncOperation<String, Integer>(op) {
@Override
public Integer getResult() {
return Integer.valueOf(op.getResult());
}
};
deleteRequest.listen();
final LinkedList<Integer> result = new LinkedList<>();
deleteRequest.register(new AsyncCallback<Integer>() {
@Override
Expand All @@ -134,12 +135,13 @@ public void done(AsyncOperation<Integer> op) {
}
{
final AsyncOperationImpl<String> op = new AsyncOperationImpl<>("test", "desc");
AsyncOperation<Integer> deleteRequest = new RedirectedAsyncOperation<String, Integer>(op) {
var deleteRequest = new RedirectedAsyncOperation<String, Integer>(op) {
@Override
public Integer getResult() {
return Integer.valueOf(op.getResult());
}
};
deleteRequest.listen();
op.setFailure(new Exception("foo"));
assertTrue(deleteRequest.isDone());
assertEquals("foo", deleteRequest.getCause().getMessage());
Expand Down Expand Up @@ -182,7 +184,7 @@ public void successfullyDone(AsyncOperation<String> source) {
}
}

private abstract class StressThread implements Runnable {
private abstract static class StressThread implements Runnable {
private final Object monitor;
private boolean running = true;

Expand Down Expand Up @@ -210,20 +212,20 @@ public void run() {
public abstract void doTask();
}

private abstract class AsyncOpStressThread extends StressThread {
private abstract static class AsyncOpStressThread extends StressThread {
public AsyncOperationImpl<String> op;
public AsyncOpStressThread(Object monitor) { super(monitor); }
@Override
public boolean hasTask() { return op != null; }
}

private class Completer extends AsyncOpStressThread {
private static class Completer extends AsyncOpStressThread {
public Completer(Object monitor) { super(monitor); }
@Override
public void doTask() { op.setResult("foo"); op = null; }
}

private class Listener extends AsyncOpStressThread implements AsyncCallback<String> {
private static class Listener extends AsyncOpStressThread implements AsyncCallback<String> {
int counter = 0;
int unset = 0;
int priorReg = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*
* @author mortent
*/
public class DataplaneProxyService extends AbstractComponent {
public final class DataplaneProxyService extends AbstractComponent {

private static final Logger logger = Logger.getLogger(DataplaneProxyService.class.getName());
private static final String PREFIX = "/opt/vespa";
Expand Down