Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the issue: Create child orders in IgniteOrderLoaderMain created less than expected due to method is not threadsafe #1367

Merged
merged 1 commit into from
Jun 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix the issue: Create child orders in IgniteOrderLoaderMain created l…
…ess than expected due to method is not threadsafe
  • Loading branch information
wendymiaoo authored May 29, 2024
commit 6b4187d11778b35da33f46e0019e9c9fc49e93c8
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import org.finos.toolbox.time.Clock
import org.finos.vuu.core.module.auths.PermissionSet
import org.finos.vuu.core.module.simul.model.{ChildOrder, ParentOrder}

import java.util.concurrent.atomic.AtomicInteger
import java.util.concurrent.{ConcurrentHashMap, DelayQueue, Delayed, TimeUnit}

//case class ParentOrder(id: Int, ric: String, price: Double, quantity: Int, side: String, account: String, exchange: String, ccy: String, algo: String, volLimit: Double, filledQty: Int, openQty: Int, averagePrice: Double, status: String, remainingQty: Int, activeChildren: Int, owner: String = "", permissionMask: Int = 0)
Expand Down Expand Up @@ -82,7 +83,7 @@ class ParentChildOrdersModel(implicit clock: Clock,
private final val queue = new DelayQueue[DelayQueueAction]()
private final var cycleNumber = 0l
private var orderId = 0
private var childOrderId = 0
private var childOrderId = new AtomicInteger(0);
private final val MAX_ORDERS = 7000
private var parentOrderCount = 0;

Expand Down Expand Up @@ -308,8 +309,7 @@ class ParentChildOrdersModel(implicit clock: Clock,
}

def createChild(parentOrder: ParentOrder): ChildOrder = {
val childId = childOrderId
childOrderId += 1
val childId = childOrderId.getAndIncrement()
val quantity = parentOrder.quantity
val side = parentOrder.side
val account = parentOrder.account
Expand Down
Loading