Skip to content

Commit

Permalink
Add dummy strand for no strand case
Browse files Browse the repository at this point in the history
  • Loading branch information
warunalakshitha committed Apr 25, 2024
1 parent 6ac3162 commit 2adf17c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ private static BMap<BString, Object> populateRecordDefaultValues(
BMap<BString, Object> recordValue, Map<String, BFunctionPointer<Object, ?>> defaultValues) {
Strand strand = Scheduler.getStrandNoException();
if (strand == null) {
strand = Scheduler.getDaemonStrand();
strand = new Strand();
}
for (Map.Entry<String, BFunctionPointer<Object, ?>> field : defaultValues.entrySet()) {
recordValue.populateInitialValue(StringUtils.fromString(field.getKey()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@ public class Strand {
public BMap<BString, Object> workerReceiveMap = null;
public int channelCount = 0;

public Strand() {
this.id = -1;
this.strandLock = null;
this.name = null;
this.metadata = null;
this.state = RUNNABLE;
}

public Strand(String name, StrandMetadata metadata, Scheduler scheduler, Strand parent,
Map<String, Object> properties) {
this.id = nextStrandId.incrementAndGet();
Expand Down

0 comments on commit 2adf17c

Please sign in to comment.