Skip to content

Commit 5866290

Browse files
committed
Moved some customs over
1 parent 62e7011 commit 5866290

3 files changed

Lines changed: 64 additions & 0 deletions

File tree

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ online {
1414

1515
dependencies {
1616
githubImplementation 'intisy:simple-logger:1.14'
17+
implementation 'org.apache.httpcomponents:httpclient:4.5.14'
1718
implementation "org.kohsuke:github-api:1.99"
1819
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package io.github.intisy.utils.custom;
2+
3+
import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
4+
import java.net.URI;
5+
6+
public class HttpDeleteWithBody extends HttpEntityEnclosingRequestBase {
7+
8+
public static final String METHOD_NAME = "DELETE";
9+
10+
public HttpDeleteWithBody() {
11+
super();
12+
}
13+
14+
public HttpDeleteWithBody(final URI uri) {
15+
super();
16+
setURI(uri);
17+
}
18+
19+
public HttpDeleteWithBody(final String uri) {
20+
super();
21+
setURI(URI.create(uri));
22+
}
23+
24+
@Override
25+
public String getMethod() {
26+
return METHOD_NAME;
27+
}
28+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package io.github.intisy.utils.custom;
2+
3+
import java.util.concurrent.locks.Condition;
4+
import java.util.concurrent.locks.Lock;
5+
import java.util.concurrent.locks.ReentrantLock;
6+
7+
public class Wait {
8+
private final Lock lock = new ReentrantLock();
9+
private final Condition condition = lock.newCondition();
10+
private boolean variable = false;
11+
12+
public void waitForVariable(boolean variable) throws InterruptedException {
13+
lock.lock();
14+
try {
15+
while (this.variable != variable) {
16+
condition.await();
17+
}
18+
} finally {
19+
lock.unlock();
20+
}
21+
}
22+
23+
public void setVariable(boolean value) {
24+
lock.lock();
25+
try {
26+
variable = value;
27+
condition.signalAll();
28+
} finally {
29+
lock.unlock();
30+
}
31+
}
32+
public boolean getVariable() {
33+
return variable;
34+
}
35+
}

0 commit comments

Comments
 (0)