Examples of PriorityGenerator


Examples of akka.dispatch.PriorityGenerator

  public static class MyPriorityMailBox extends UnboundedPriorityMailbox {

    public MyPriorityMailBox(ActorSystem.Settings settings, Config config) {

      // Creating a new PriorityGenerator,
      super(new PriorityGenerator() {
        @Override
        public int gen(Object message) {
          if (message.equals("DISPLAY_LIST"))
            return 2; // 'DisplayList messages should be treated
                  // last if possible
View Full Code Here

Examples of akka.dispatch.PriorityGenerator

    public MyUnboundedPriorityMailbox(ActorSystem.Settings settings,
        Config config) {

      // Creating a new PriorityGenerator,
      super(new PriorityGenerator() {
        @Override
        public int gen(Object message) {
          if (message instanceof Address)
            return 0; // Worker Registration messages should be
                  // treated
View Full Code Here

Examples of akka.dispatch.PriorityGenerator

  //#prio-mailbox
  public class MyPrioMailbox extends UnboundedPriorityMailbox {
    // needed for reflective instantiation
    public MyPrioMailbox(ActorSystem.Settings settings, Config config) {
      // Create a new PriorityGenerator, lower prio means more important
      super(new PriorityGenerator() {
        @Override
        public int gen(Object message) {
          if (message.equals("highpriority"))
            return 0; // 'highpriority messages should be treated first if possible
          else if (message.equals("lowpriority"))
View Full Code Here

Examples of org.eclipse.jetty.http2.generator.PriorityGenerator

    private final ByteBufferPool byteBufferPool = new MappedByteBufferPool();

    @Test
    public void testGenerateParse() throws Exception
    {
        PriorityGenerator generator = new PriorityGenerator(new HeaderGenerator());

        final List<PriorityFrame> frames = new ArrayList<>();
        Parser parser = new Parser(byteBufferPool, new Parser.Listener.Adapter()
        {
            @Override
            public boolean onPriority(PriorityFrame frame)
            {
                frames.add(frame);
                return false;
            }
        }, 4096, 8192);

        int streamId = 13;
        int dependentStreamId = 17;
        int weight = 3;
        boolean exclusive = true;

        // Iterate a few times to be sure generator and parser are properly reset.
        for (int i = 0; i < 2; ++i)
        {
            ByteBufferPool.Lease lease = new ByteBufferPool.Lease(byteBufferPool);
            generator.generatePriority(lease, streamId, dependentStreamId, weight, exclusive);

            frames.clear();
            for (ByteBuffer buffer : lease.getByteBuffers())
            {
                while (buffer.hasRemaining())
View Full Code Here

Examples of org.eclipse.jetty.http2.generator.PriorityGenerator

    }

    @Test
    public void testGenerateParseOneByteAtATime() throws Exception
    {
        PriorityGenerator generator = new PriorityGenerator(new HeaderGenerator());

        final List<PriorityFrame> frames = new ArrayList<>();
        Parser parser = new Parser(byteBufferPool, new Parser.Listener.Adapter()
        {
            @Override
            public boolean onPriority(PriorityFrame frame)
            {
                frames.add(frame);
                return false;
            }
        }, 4096, 8192);

        int streamId = 13;
        int dependentStreamId = 17;
        int weight = 3;
        boolean exclusive = true;

        ByteBufferPool.Lease lease = new ByteBufferPool.Lease(byteBufferPool);
        generator.generatePriority(lease, streamId, dependentStreamId, weight, exclusive);

        for (ByteBuffer buffer : lease.getByteBuffers())
        {
            while (buffer.hasRemaining())
            {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.