mirror of
https://github.com/google/nomulus.git
synced 2025-05-15 08:57:12 +02:00
Create an injectable LockHandler
We create an injectable LockHandler that just calls the static Lock.executeWithLocks function. I'm not sure what's the correct place to put the LockHandler. I think model/server is only appropriate for the actual datastore lock. This is a "per request" lock, so maybe request/lock? ----------------------------- This is the initial step in adding the "lock implicitly released on request death" feature, but it's also useful on its own - easier to test Actions when we can use a fake lock. To keep this CL simple, we keep using the old Lock as is in most places. We just choose a single example to convert to LockHandler to showcase it. Converting all other uses will be in a subsequent CL. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=167357564
This commit is contained in:
parent
67276888d2
commit
978149e677
7 changed files with 85 additions and 17 deletions
|
@ -12,7 +12,7 @@ java_library(
|
|||
),
|
||||
deps = [
|
||||
"//java/google/registry/request/auth",
|
||||
"//java/google/registry/security",
|
||||
"//java/google/registry/request/lock",
|
||||
"//java/google/registry/util",
|
||||
"@com_google_appengine_api_1_0_sdk",
|
||||
"@com_google_auto_value",
|
||||
|
|
|
@ -27,6 +27,8 @@ import dagger.Provides;
|
|||
import google.registry.request.HttpException.BadRequestException;
|
||||
import google.registry.request.HttpException.UnsupportedMediaTypeException;
|
||||
import google.registry.request.auth.AuthResult;
|
||||
import google.registry.request.lock.LockHandler;
|
||||
import google.registry.request.lock.LockHandlerPassthrough;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
@ -122,6 +124,11 @@ public final class RequestModule {
|
|||
}
|
||||
}
|
||||
|
||||
@Provides
|
||||
static LockHandler provideLockHandler(LockHandlerPassthrough lockHandler) {
|
||||
return lockHandler;
|
||||
}
|
||||
|
||||
@Provides
|
||||
@JsonPayload
|
||||
@SuppressWarnings("unchecked")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue