Skip to content

Commit

Permalink
Remove unused method from the LocalNewSessionQueue
Browse files Browse the repository at this point in the history
  • Loading branch information
shs96c committed Apr 26, 2021
1 parent 7fd49ca commit 921241d
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 96 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ protected NewSessionQueue(Tracer tracer, Secret registrationSecret) {
throw new UncheckedIOException(e);
}
}),
post("/se/grid/newsessionqueue/session/last")
.to(() -> new OfferLastToSessionQueue(tracer, this)),
post("/se/grid/newsessionqueue/session")
.to(() -> new AddToSessionQueue(tracer, this)),
post("/se/grid/newsessionqueue/session/{requestId}/retry")
Expand All @@ -103,8 +101,6 @@ private RequestId requestIdFrom(Map<String, String> params) {

public abstract HttpResponse addToQueue(SessionRequest request);

public abstract boolean offerLast(SessionRequest request);

public abstract boolean retryAddToQueue(SessionRequest request);

public abstract Optional<SessionRequest> remove(RequestId reqId);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -211,27 +211,6 @@ Data injectIntoQueue(SessionRequest request) {
return data;
}

@Override
public boolean offerLast(SessionRequest request) {
Require.nonNull("New session request", request);

Lock writeLock = lock.writeLock();
writeLock.lock();
try {
if (!requests.containsKey(request.getRequestId())) {
return false;
}

if (queue.contains(request)) {
return true;
}

return queue.offerLast(request);
} finally {
writeLock.unlock();
}
}

@Override
public boolean retryAddToQueue(SessionRequest request) {
Require.nonNull("New session request", request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,6 @@ public HttpResponse addToQueue(SessionRequest request) {
return client.execute(upstream);
}

@Override
public boolean offerLast(SessionRequest request) {
HttpRequest upstream = new HttpRequest(POST, "/se/grid/newsessionqueue/session/last");
HttpTracing.inject(tracer, tracer.getCurrentContext(), upstream);
upstream.setContent(Contents.asJson(request));
HttpResponse response = client.execute(upstream);
return Values.get(response, Boolean.class);
}

@Override
public boolean retryAddToQueue(SessionRequest request) {
Require.nonNull("Session request", request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ public void shouldBeClearQueueAndFireRejectedEvent() throws InterruptedException
localQueue.injectIntoQueue(sessionRequest);
queue.remove(requestId);

queue.offerLast(sessionRequest);
queue.retryAddToQueue(sessionRequest);

int count = queue.clearQueue();

Expand Down

0 comments on commit 921241d

Please sign in to comment.