Skip to main content

Ernest Lee

Ernest Lee's Public Library

  • n computing, an idempotent operation is one that has no additional effect if it is called more than once with the same input parameters. For example, removing an item from a set can be considered an idempotent operation on the set.

      

    In mathematics, an idempotent operation is one where f(f(x)) = f(x). For example, the abs() function is idempotent because abs(abs(x)) = abs(x) for all x.

  • public final class NetworkBatchHandler
        implements EventHander<Message>
    {
        private final NetworkFacade network;
        private final ByteBuffer buffer;
     
        public NetworkBatchHandler(final NetworkFacade network,
                                   final int maxPacketSize)
        {
            this.network = network;
            buffer = ByteBuffer.allocate(maxPacketSize);
        }
         
        public void onEvent(Message msg, long sequence, boolean endOfBatch)
            throws Exception
        {
            if (msg.size() > buffer.remaining())
            {
                sendBuffer();
            }
     
            buffer.put(msg.getBytes());
             
            if (endOfBatch)
            {
                sendBuffer();
            }
        }
     
        private void sendBuffer()
        {
            buffer.flip();
            network.send(buffer);
            buffer.clear();
        }   
    }

  • In Vert.x 3, the module infrastructure used by Vert.x 2 was effectively abandoned, and the model for loading classes by default changed so that each verticle (the unit of code in Vert.x) is loaded by the current classloader, in effect leading to a single flat classpath within the application. This makes a Vert.x deployment essentially like any other JVM application. It is possible to deploy a verticle in an isolated classloader, but this is not the default behaviour.
1 - 20 of 3239 Next › Last »
20 items/page

Diigo is about better ways to research, share and collaborate on information. Learn more »

Join Diigo