All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.contek.invoker.hbdminverse.api.websocket.user.UserWebSocketApi Maven / Gradle / Ivy

There is a newer version: 3.6.19
Show newest version
package io.contek.invoker.hbdminverse.api.websocket.user;

import io.contek.invoker.commons.actor.IActor;
import io.contek.invoker.commons.websocket.WebSocketContext;
import io.contek.invoker.hbdminverse.api.websocket.common.notification.NotificationWebSocketApi;

import javax.annotation.concurrent.ThreadSafe;
import java.util.HashMap;
import java.util.Map;

@ThreadSafe
public final class UserWebSocketApi extends NotificationWebSocketApi {

  private final Map tradeDetailChannels =
      new HashMap<>();

  public UserWebSocketApi(IActor actor, WebSocketContext context) {
    super(actor, context);
  }

  public TriggerOrderChannel getTriggerOrderChannel(String contractCode) {
    synchronized (tradeDetailChannels) {
      return tradeDetailChannels.computeIfAbsent(
          TriggerOrderChannel.Id.of(contractCode),
          k -> {
            TriggerOrderChannel result = new TriggerOrderChannel(k, getRequestIdGenerator());
            attach(result);
            return result;
          });
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy