Class TicketMachine

java.lang.Object
org.nustaq.kontraktor.util.TicketMachine

public class TicketMachine
extends java.lang.Object
Created by ruedi on 02.06.14. Single threaded, can be used from within one actor only ! Problem: you complete a stream of events related to some items (e.g. UserSessions or Trades) you need to do some asynchronous lookups during processing (e.g. query data async) now you want to process parallel, but need to process events related to a single item in order (e.g. want to process trades related to say BMW in the order they come in). usage: ticketMachine.getTicket( "BMW" ).then( (endSignalfuture,e) -> { .. wild async processing .. endsignalFuture.complete("done",null); // will execute next event on bmw if present }); Note Actor.serialOn internally makes use of this
  • Constructor Summary

    Constructors 
    Constructor Description
    TicketMachine()  
  • Method Summary

    Modifier and Type Method Description
    IPromise<IPromise> getTicket​(java.lang.Object channelKey)  
    java.util.HashMap<java.lang.Object,​java.util.List<org.nustaq.kontraktor.util.TicketMachine.Ticket>> getTickets()  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • getTicket

      public IPromise<IPromise> getTicket​(java.lang.Object channelKey)
    • getTickets

      public java.util.HashMap<java.lang.Object,​java.util.List<org.nustaq.kontraktor.util.TicketMachine.Ticket>> getTickets()