diff --git a/core.iml b/core.iml deleted file mode 100644 index 11746d5..0000000 --- a/core.iml +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/java/com/rubix/core/Controllers/Basics.java b/src/main/java/com/rubix/core/Controllers/Basics.java index 5d86b0e..4cec100 100644 --- a/src/main/java/com/rubix/core/Controllers/Basics.java +++ b/src/main/java/com/rubix/core/Controllers/Basics.java @@ -2,12 +2,10 @@ import com.rubix.Consensus.QuorumConsensus; import com.rubix.Ping.PingCheck; +import com.rubix.Resources.APIHandler; import com.rubix.Resources.Functions; import com.rubix.Resources.IPFSNetwork; -import com.rubix.core.Resources.Background; -import com.rubix.core.Resources.QuorumPingReceiveThread; -import com.rubix.core.Resources.Receiver; -import com.rubix.core.Resources.ReceiverPingReceive; +import com.rubix.core.Resources.*; import io.ipfs.api.IPFS; import org.json.JSONArray; import org.json.JSONException; @@ -71,6 +69,10 @@ public static String start() throws JSONException, IOException { Thread quorumPingThread = new Thread(quorumPingReceiveThread); quorumPingThread.start(); + QuorumCreditsThread quorumCredits = new QuorumCreditsThread(); + Thread creditsThread = new Thread(quorumCredits); + creditsThread.start(); + tokenBank(); System.out.println(repo()); @@ -92,9 +94,9 @@ public static String start() throws JSONException, IOException { writeToFile(partTokensFile.toString(), "[]", false); } -// Background background = new Background(); -// Thread backThread = new Thread(background); -// backThread.start(); + Background background = new Background(); + Thread backThread = new Thread(background); + backThread.start(); JSONObject result = new JSONObject(); JSONObject contentObject = new JSONObject(); @@ -298,6 +300,13 @@ public static Double tokenParts(@RequestParam("token") String tokenHash) { } + @RequestMapping(value = "/arrangeQuorum", method = RequestMethod.GET, + produces = {"application/json", "application/xml"}) + public static String arrangeQuorum() { + return APIHandler.sortType2Quorum().toString(); + + } + @RequestMapping(value = {"/validateReceiver"}, method = {RequestMethod.GET}, produces = {"application/json", "application/xml"}) public String validateReceiver(@RequestParam("receiverDID") String receiverDID) throws IOException { System.out.println(receiverDID); diff --git a/src/main/java/com/rubix/core/Resources/QuorumCreditsThread.java b/src/main/java/com/rubix/core/Resources/QuorumCreditsThread.java new file mode 100644 index 0000000..89ad607 --- /dev/null +++ b/src/main/java/com/rubix/core/Resources/QuorumCreditsThread.java @@ -0,0 +1,21 @@ +package com.rubix.core.Resources; + +import com.rubix.Ping.QuorumSendCredits; +import org.json.JSONException; + +import static com.rubix.Resources.Functions.QUORUM_PORT; +import static com.rubix.Resources.Functions.pathSet; + +public class QuorumCreditsThread implements Runnable { + @Override + public void run() { + while (true) { + try { + pathSet(); + QuorumSendCredits.sendCredits(QUORUM_PORT + 420); + } catch (JSONException e) { + e.printStackTrace(); + } + } + } +}