Search in sources :

Example 1 with ThroughputLimitQueue

use of com.yahoo.documentapi.ThroughputLimitQueue in project vespa by vespa-engine.

the class DummyReceiver method init.

public void init() {
    MessageBusParams params = new MessageBusParams(new LoadTypeSet());
    params.setRPCNetworkParams(new RPCNetworkParams().setIdentity(new Identity(name)));
    params.setDocumentManagerConfigId("client");
    params.getMessageBusParams().setMaxPendingCount(maxPendingCount);
    params.getMessageBusParams().setMaxPendingSize(0);
    da = new MessageBusDocumentAccess(params);
    queue = (maxQueueTime < 0) ? new LinkedBlockingDeque<>() : new ThroughputLimitQueue<>(maxQueueTime);
    session = da.getMessageBus().createDestinationSession("default", true, this);
    executor = new ThreadPoolExecutor(threads, threads, 5, TimeUnit.SECONDS, queue, new DaemonThreadFactory());
    System.out.println("Registered listener at " + name + "/default with " + maxPendingCount + " max pending and sleep time of " + sleepTime);
}
Also used : LinkedBlockingDeque(java.util.concurrent.LinkedBlockingDeque) RPCNetworkParams(com.yahoo.messagebus.network.rpc.RPCNetworkParams) MessageBusDocumentAccess(com.yahoo.documentapi.messagebus.MessageBusDocumentAccess) DaemonThreadFactory(com.yahoo.concurrent.DaemonThreadFactory) MessageBusParams(com.yahoo.documentapi.messagebus.MessageBusParams) ThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor) Identity(com.yahoo.messagebus.network.Identity) ThroughputLimitQueue(com.yahoo.documentapi.ThroughputLimitQueue) LoadTypeSet(com.yahoo.documentapi.messagebus.loadtypes.LoadTypeSet)

Aggregations

DaemonThreadFactory (com.yahoo.concurrent.DaemonThreadFactory)1 ThroughputLimitQueue (com.yahoo.documentapi.ThroughputLimitQueue)1 MessageBusDocumentAccess (com.yahoo.documentapi.messagebus.MessageBusDocumentAccess)1 MessageBusParams (com.yahoo.documentapi.messagebus.MessageBusParams)1 LoadTypeSet (com.yahoo.documentapi.messagebus.loadtypes.LoadTypeSet)1 Identity (com.yahoo.messagebus.network.Identity)1 RPCNetworkParams (com.yahoo.messagebus.network.rpc.RPCNetworkParams)1 LinkedBlockingDeque (java.util.concurrent.LinkedBlockingDeque)1 ThreadPoolExecutor (java.util.concurrent.ThreadPoolExecutor)1