Skip to content

Commit

Permalink
Disabled teacher pull send task
Browse files Browse the repository at this point in the history
Signed-off-by: Artem Ananev <[email protected]>
  • Loading branch information
artemananiev committed Mar 28, 2024
1 parent ce20ae2 commit 238d515
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ private void run() {
anticipatedMessages.getAndUpdate((final int value) -> value == 0 ? 0 : (value - 1));

if (previous == 0) {
Thread.onSpinWait();
MILLISECONDS.sleep(1);
continue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ public PullVirtualTreeResponse() {
/**
* This constructor is used by the teacher to create new responses.
*/
public PullVirtualTreeResponse(final VirtualTeacherTreeView teacherView, final long path, final Hash hash) {
public PullVirtualTreeResponse(final VirtualTeacherTreeView teacherView, final PullVirtualTreeRequest request) {
this.teacherView = teacherView;
this.learnerView = null;
this.path = path;
this.hash = hash;
this.path = request.getPath();
this.hash = request.getHash();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ private void rateLimit() throws InterruptedException {
* This thread is responsible for sending lessons (and nested queries) to the learner.
*/
private void run() {
try {
try (out) {
while (true) {
rateLimit();
final PullVirtualTreeRequest request = new PullVirtualTreeRequest(view);
Expand All @@ -120,7 +120,9 @@ private void run() {
logger.info(RECONNECT.getMarker(), "Teacher receiver is complete as requested by the learner");
break;
}
view.registerRequest(request);
// view.registerRequest(request);
final PullVirtualTreeResponse response = new PullVirtualTreeResponse(view, request);
out.sendAsync(response);
}
// logger.info(RECONNECT.getMarker(), "TOREMOVE Teacher receive done");
// System.err.println("TOREMOVE Teacher receive done");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ public void startTeacherTasks(
final TeacherPullVirtualTreeReceiveTask teacherReceiveTask = new TeacherPullVirtualTreeReceiveTask(
time, reconnectConfig, workGroup, inputStream, out, this, allRequestsReceived);
teacherReceiveTask.exec();
final TeacherPullVirtualTreeSendTask teacherSendTask = new TeacherPullVirtualTreeSendTask(
reconnectConfig, workGroup, out, this, allRequestsReceived);
teacherSendTask.exec();
// final TeacherPullVirtualTreeSendTask teacherSendTask = new TeacherPullVirtualTreeSendTask(
// reconnectConfig, workGroup, out, this, allRequestsReceived);
// teacherSendTask.exec();
}

private boolean isLeaf(final long path) {
Expand Down Expand Up @@ -153,8 +153,7 @@ public Hash loadHash(final long path) {

@Override
public void registerRequest(final PullVirtualTreeRequest request) {
responses.addLast(new PullVirtualTreeResponse(
TeacherPullVirtualTreeView.this, request.getPath(), request.getHash()));
responses.addLast(new PullVirtualTreeResponse(this, request));
}

@Override
Expand Down

0 comments on commit 238d515

Please sign in to comment.