Skip to content
Snippets Groups Projects
Commit a7012bca authored by Freifrau von Bleifrei's avatar Freifrau von Bleifrei
Browse files

cleaned up a bit

parent 72a222df
Branches master
No related tags found
No related merge requests found
import datamodel.Bank;
import datamodel.BankAccount;
import datamodel.Contract;
......@@ -25,22 +23,18 @@ import utils.Utils;
// hacky reflection stuff: https://stackoverflow.com/questions/3301635/change-private-static-final-field-using-java-reflection
// or https://zarnekow.blogspot.com/2013/01/java-hacks-changing-final-fields.htmlBlockedForEachLinkedBlockingQueue
// but probably, this is still inlining the Config constants
// TODO but probably, the compiler is still inlining the Config constants, find a way to keep it from doing that
import java.lang.reflect.*;
import java.security.AccessController;
import java.security.PrivilegedAction;
class EverythingIsTrue {
protected static void setValue(Object owner, Field field, Object value) throws Exception {
makeModifiable(field);
field.set(owner, value);
}
protected static void makeModifiable(Field field) throws Exception {
field.setAccessible(true);
int modifiers = field.getModifiers();
Field modifierField = field.getClass().getDeclaredField("modifiers");
modifiers = modifiers & ~Modifier.FINAL;
// modifierField.setAccessible(true);
// wrapping setAccessible
......@@ -51,6 +45,12 @@ class EverythingIsTrue {
modifierField.setInt(field, modifiers);
}
protected static void setValue(Object owner, Field field, Object value) throws Exception {
makeModifiable(field);
field.set(owner, value);
}
static void setFinalStatic(Field field, Object newValue) throws Exception {
setValue(null, field, newValue);
}
......@@ -201,6 +201,7 @@ class Print implements Runnable{
public Print() {
this.printSystemMessageQueue = MessageQueue.getInstance();
//java.util.concurrent.ForkJoinPool.common.parallelism=8;
//System.out.println(Config.PRINT_DURATION_MILLISECONDS);
try {
// Systems config
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment