-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
55 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package de.malkusch.km200.http; | ||
|
||
import java.io.IOException; | ||
|
||
import de.malkusch.km200.KM200Exception; | ||
|
||
public final class SerializedHttp implements Http { | ||
|
||
private final Http http; | ||
|
||
public SerializedHttp(Http http) { | ||
this.http = http; | ||
} | ||
|
||
private final Object lock = new Object(); | ||
|
||
@Override | ||
public Response get(String path) throws IOException, InterruptedException, KM200Exception { | ||
synchronized (lock) { | ||
return http.get(path); | ||
} | ||
} | ||
|
||
@Override | ||
public Response post(String path, byte[] body) throws IOException, InterruptedException, KM200Exception { | ||
synchronized (lock) { | ||
return http.post(path, body); | ||
} | ||
} | ||
} |