Skip to content
This repository was archived by the owner on Jul 7, 2020. It is now read-only.
Open
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 @@ -39,6 +39,7 @@
*/
public class ValueFilterRandom extends AbstractValueFilter {

private static final Object lock = new Object();
private final Random random = new Random();

/**
Expand Down Expand Up @@ -91,7 +92,7 @@ public class ValueFilterRandom extends AbstractValueFilter {
@Override
public ValueObject filterValue(ValueObject value) {
if (gaussian) {
synchronized (nextGaussian) {
synchronized (lock) {
return ValueFactory.create(nextGaussian(mu, sigma));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,13 @@ public InputStream createInputStream() throws IOException {
*/
public static final class InjectorStreamSource extends FactoryInputStream {

private static final Object lock = new Object();
public static final String DefautlInjectorKey = "secretDefaultInjectorKey";
private static final IdentityHashMap<String, LinkedBlockingQueue<InputStream>> park = new IdentityHashMap<>();

public static final void inject(String key, InputStream in) {
key = key.intern();
synchronized (key) {
synchronized (lock) {
try {
LinkedBlockingQueue<InputStream> queue = null;
synchronized (park) {
Expand Down Expand Up @@ -120,7 +121,7 @@ public InputStream createInputStream() throws IOException {
try {
while (queue == null) {
key = key.intern();
synchronized (key) {
synchronized (lock) {
synchronized (park) {
queue = park.get(key);
}
Expand Down