Java 类com.lmax.disruptor.EventTranslatorTwoArg 实例源码

项目:jstorm-0.9.6.3-    文件:RingBuffer.java   
private <A, B> void translateAndPublishBatch(final EventTranslatorTwoArg<E, A, B> translator, final A[] arg0,
                                             final B[] arg1, int batchStartsAt, int batchSize,
                                             final long finalSequence)
{
    final long initialSequence = finalSequence - (batchSize - 1);
    try
    {
        long sequence = initialSequence;
        final int batchEndsAt = batchStartsAt + batchSize;
        for (int i = batchStartsAt; i < batchEndsAt; i++)
        {
            translator.translateTo(get(sequence), sequence++, arg0[i], arg1[i]);
        }
    }
    finally
    {
        sequencer.publish(initialSequence, finalSequence);
    }
}
项目:learn_jstorm    文件:RingBuffer.java   
private <A, B> void translateAndPublishBatch(final EventTranslatorTwoArg<E, A, B> translator, final A[] arg0,
                                             final B[] arg1, int batchStartsAt, int batchSize,
                                             final long finalSequence)
{
    final long initialSequence = finalSequence - (batchSize - 1);
    try
    {
        long sequence = initialSequence;
        final int batchEndsAt = batchStartsAt + batchSize;
        for (int i = batchStartsAt; i < batchEndsAt; i++)
        {
            translator.translateTo(get(sequence), sequence++, arg0[i], arg1[i]);
        }
    }
    finally
    {
        sequencer.publish(initialSequence, finalSequence);
    }
}
项目:Tstream    文件:RingBuffer.java   
private <A, B> void translateAndPublishBatch(final EventTranslatorTwoArg<E, A, B> translator, final A[] arg0,
                                             final B[] arg1, int batchStartsAt, int batchSize,
                                             final long finalSequence)
{
    final long initialSequence = finalSequence - (batchSize - 1);
    try
    {
        long sequence = initialSequence;
        final int batchEndsAt = batchStartsAt + batchSize;
        for (int i = batchStartsAt; i < batchEndsAt; i++)
        {
            translator.translateTo(get(sequence), sequence++, arg0[i], arg1[i]);
        }
    }
    finally
    {
        sequencer.publish(initialSequence, finalSequence);
    }
}
项目:jstorm-0.9.6.3-    文件:RingBuffer.java   
/**
 * Allows two user supplied arguments.
 *
 * @see #tryPublishEvent(EventTranslator)
 * @param translator The user specified translation for the event
 * @param arg0 A user supplied argument.
 * @param arg1 A user supplied argument.
 * @return true if the value was published, false if there was insufficient
 * capacity.
 */
public <A, B> boolean tryPublishEvent(EventTranslatorTwoArg<E, A, B> translator, A arg0, B arg1)
{
    try
    {
        final long sequence = sequencer.tryNext();
        translateAndPublish(translator, sequence, arg0, arg1);
        return true;
    }
    catch (InsufficientCapacityException e)
    {
        return false;
    }
}
项目:jstorm-0.9.6.3-    文件:RingBuffer.java   
/**
 * Allows two user supplied arguments per event.
 *
 * @param translator    The user specified translation for the event
 * @param batchStartsAt The first element of the array which is within the batch.
 * @param batchSize     The actual size of the batch.
 * @param arg0          An array of user supplied arguments, one element per event.
 * @param arg1          An array of user supplied arguments, one element per event.
 * @return true if the value was published, false if there was insufficient
 *         capacity.
 * @see #tryPublishEvents(EventTranslator[])
 */
public <A, B> boolean tryPublishEvents(EventTranslatorTwoArg<E, A, B> translator, int batchStartsAt, int batchSize, A[] arg0, B[] arg1)
{
    checkBounds(arg0, arg1, batchStartsAt, batchSize);
    try
    {
        final long finalSequence = sequencer.tryNext(batchSize);
        translateAndPublishBatch(translator, arg0, arg1, batchStartsAt, batchSize, finalSequence);
        return true;
    }
    catch (InsufficientCapacityException e)
    {
        return false;
    }
}
项目:jstorm-0.9.6.3-    文件:RingBuffer.java   
private <A, B> void translateAndPublish(EventTranslatorTwoArg<E, A, B> translator, long sequence, A arg0, B arg1)
{
    try
    {
        translator.translateTo(get(sequence), sequence, arg0, arg1);
    }
    finally
    {
        sequencer.publish(sequence);
    }
}
项目:learn_jstorm    文件:RingBuffer.java   
/**
 * Allows two user supplied arguments.
 *
 * @see #tryPublishEvent(EventTranslator)
 * @param translator The user specified translation for the event
 * @param arg0 A user supplied argument.
 * @param arg1 A user supplied argument.
 * @return true if the value was published, false if there was insufficient
 * capacity.
 */
public <A, B> boolean tryPublishEvent(EventTranslatorTwoArg<E, A, B> translator, A arg0, B arg1)
{
    try
    {
        final long sequence = sequencer.tryNext();
        translateAndPublish(translator, sequence, arg0, arg1);
        return true;
    }
    catch (InsufficientCapacityException e)
    {
        return false;
    }
}
项目:learn_jstorm    文件:RingBuffer.java   
/**
 * Allows two user supplied arguments per event.
 *
 * @param translator    The user specified translation for the event
 * @param batchStartsAt The first element of the array which is within the batch.
 * @param batchSize     The actual size of the batch.
 * @param arg0          An array of user supplied arguments, one element per event.
 * @param arg1          An array of user supplied arguments, one element per event.
 * @return true if the value was published, false if there was insufficient
 *         capacity.
 * @see #tryPublishEvents(EventTranslator[])
 */
public <A, B> boolean tryPublishEvents(EventTranslatorTwoArg<E, A, B> translator, int batchStartsAt, int batchSize, A[] arg0, B[] arg1)
{
    checkBounds(arg0, arg1, batchStartsAt, batchSize);
    try
    {
        final long finalSequence = sequencer.tryNext(batchSize);
        translateAndPublishBatch(translator, arg0, arg1, batchStartsAt, batchSize, finalSequence);
        return true;
    }
    catch (InsufficientCapacityException e)
    {
        return false;
    }
}
项目:learn_jstorm    文件:RingBuffer.java   
private <A, B> void translateAndPublish(EventTranslatorTwoArg<E, A, B> translator, long sequence, A arg0, B arg1)
{
    try
    {
        translator.translateTo(get(sequence), sequence, arg0, arg1);
    }
    finally
    {
        sequencer.publish(sequence);
    }
}
项目:jstrom    文件:RingBuffer.java   
/**
 * Allows two user supplied arguments.
 * 
 * @see #tryPublishEvent(EventTranslator)
 * @param translator The user specified translation for the event
 * @param arg0 A user supplied argument.
 * @param arg1 A user supplied argument.
 * @return true if the value was published, false if there was insufficient capacity.
 */
public <A, B> boolean tryPublishEvent(EventTranslatorTwoArg<E, A, B> translator, A arg0, B arg1) {
    try {
        final long sequence = sequencer.tryNext();
        translateAndPublish(translator, sequence, arg0, arg1);
        return true;
    } catch (InsufficientCapacityException e) {
        return false;
    }
}
项目:jstrom    文件:RingBuffer.java   
private <A, B> void translateAndPublish(EventTranslatorTwoArg<E, A, B> translator, long sequence, A arg0, B arg1) {
    try {
        translator.translateTo(get(sequence), sequence, arg0, arg1);
    } finally {
        sequencer.publish(sequence);
    }
}
项目:jstrom    文件:RingBuffer.java   
private <A, B> void translateAndPublishBatch(final EventTranslatorTwoArg<E, A, B> translator, final A[] arg0, final B[] arg1, int batchStartsAt,
        int batchSize, final long finalSequence) {
    final long initialSequence = finalSequence - (batchSize - 1);
    try {
        long sequence = initialSequence;
        final int batchEndsAt = batchStartsAt + batchSize;
        for (int i = batchStartsAt; i < batchEndsAt; i++) {
            translator.translateTo(get(sequence), sequence++, arg0[i], arg1[i]);
        }
    } finally {
        sequencer.publish(initialSequence, finalSequence);
    }
}
项目:Tstream    文件:RingBuffer.java   
/**
 * Allows two user supplied arguments.
 *
 * @see #tryPublishEvent(EventTranslator)
 * @param translator The user specified translation for the event
 * @param arg0 A user supplied argument.
 * @param arg1 A user supplied argument.
 * @return true if the value was published, false if there was insufficient
 * capacity.
 */
public <A, B> boolean tryPublishEvent(EventTranslatorTwoArg<E, A, B> translator, A arg0, B arg1)
{
    try
    {
        final long sequence = sequencer.tryNext();
        translateAndPublish(translator, sequence, arg0, arg1);
        return true;
    }
    catch (InsufficientCapacityException e)
    {
        return false;
    }
}
项目:Tstream    文件:RingBuffer.java   
/**
 * Allows two user supplied arguments per event.
 *
 * @param translator    The user specified translation for the event
 * @param batchStartsAt The first element of the array which is within the batch.
 * @param batchSize     The actual size of the batch.
 * @param arg0          An array of user supplied arguments, one element per event.
 * @param arg1          An array of user supplied arguments, one element per event.
 * @return true if the value was published, false if there was insufficient
 *         capacity.
 * @see #tryPublishEvents(EventTranslator[])
 */
public <A, B> boolean tryPublishEvents(EventTranslatorTwoArg<E, A, B> translator, int batchStartsAt, int batchSize, A[] arg0, B[] arg1)
{
    checkBounds(arg0, arg1, batchStartsAt, batchSize);
    try
    {
        final long finalSequence = sequencer.tryNext(batchSize);
        translateAndPublishBatch(translator, arg0, arg1, batchStartsAt, batchSize, finalSequence);
        return true;
    }
    catch (InsufficientCapacityException e)
    {
        return false;
    }
}
项目:Tstream    文件:RingBuffer.java   
private <A, B> void translateAndPublish(EventTranslatorTwoArg<E, A, B> translator, long sequence, A arg0, B arg1)
{
    try
    {
        translator.translateTo(get(sequence), sequence, arg0, arg1);
    }
    finally
    {
        sequencer.publish(sequence);
    }
}
项目:jstorm    文件:RingBuffer.java   
/**
 * Allows two user supplied arguments.
 * 
 * @see #tryPublishEvent(EventTranslator)
 * @param translator The user specified translation for the event
 * @param arg0 A user supplied argument.
 * @param arg1 A user supplied argument.
 * @return true if the value was published, false if there was insufficient capacity.
 */
public <A, B> boolean tryPublishEvent(EventTranslatorTwoArg<E, A, B> translator, A arg0, B arg1) {
    try {
        final long sequence = sequencer.tryNext();
        translateAndPublish(translator, sequence, arg0, arg1);
        return true;
    } catch (InsufficientCapacityException e) {
        return false;
    }
}
项目:jstorm    文件:RingBuffer.java   
private <A, B> void translateAndPublish(EventTranslatorTwoArg<E, A, B> translator, long sequence, A arg0, B arg1) {
    try {
        translator.translateTo(get(sequence), sequence, arg0, arg1);
    } finally {
        sequencer.publish(sequence);
    }
}
项目:jstorm    文件:RingBuffer.java   
private <A, B> void translateAndPublishBatch(final EventTranslatorTwoArg<E, A, B> translator, final A[] arg0, final B[] arg1, int batchStartsAt,
        int batchSize, final long finalSequence) {
    final long initialSequence = finalSequence - (batchSize - 1);
    try {
        long sequence = initialSequence;
        final int batchEndsAt = batchStartsAt + batchSize;
        for (int i = batchStartsAt; i < batchEndsAt; i++) {
            translator.translateTo(get(sequence), sequence++, arg0[i], arg1[i]);
        }
    } finally {
        sequencer.publish(initialSequence, finalSequence);
    }
}
项目:couchbase-jvm-core    文件:CollectingResponseEventSink.java   
@Override
public <A, B> void publishEvent(EventTranslatorTwoArg<ResponseEvent, A, B> translator, A arg0, B arg1) {
    ResponseEvent ev = new ResponseEvent();
    translator.translateTo(ev, 0, arg0, arg1);
    responseEvents.add(ev);
}
项目:couchbase-jvm-core    文件:CollectingResponseEventSink.java   
@Override
public <A, B> boolean tryPublishEvent(EventTranslatorTwoArg<ResponseEvent, A, B> translator, A arg0, B arg1) {
    throw new UnsupportedOperationException();
}
项目:couchbase-jvm-core    文件:CollectingResponseEventSink.java   
@Override
public <A, B> void publishEvents(EventTranslatorTwoArg<ResponseEvent, A, B> translator, A[] arg0, B[] arg1) {
    throw new UnsupportedOperationException();
}
项目:couchbase-jvm-core    文件:CollectingResponseEventSink.java   
@Override
public <A, B> void publishEvents(EventTranslatorTwoArg<ResponseEvent, A, B> translator, int batchStartsAt, int batchSize, A[] arg0, B[] arg1) {
    throw new UnsupportedOperationException();
}
项目:couchbase-jvm-core    文件:CollectingResponseEventSink.java   
@Override
public <A, B> boolean tryPublishEvents(EventTranslatorTwoArg<ResponseEvent, A, B> translator, A[] arg0, B[] arg1) {
    throw new UnsupportedOperationException();
}
项目:couchbase-jvm-core    文件:CollectingResponseEventSink.java   
@Override
public <A, B> boolean tryPublishEvents(EventTranslatorTwoArg<ResponseEvent, A, B> translator, int batchStartsAt, int batchSize, A[] arg0, B[] arg1) {
    throw new UnsupportedOperationException();
}
项目:jstorm-0.9.6.3-    文件:RingBuffer.java   
/**
 * Allows two user supplied arguments per event.
 *
 * @param translator    The user specified translation for the event
 * @param batchStartsAt The first element of the array which is within the batch.
 * @param batchSize     The actual size of the batch.
 * @param arg0          An array of user supplied arguments, one element per event.
 * @param arg1          An array of user supplied arguments, one element per event.
 * @see #publishEvents(EventTranslator[])
 */
public <A, B> void publishEvents(EventTranslatorTwoArg<E, A, B> translator, int batchStartsAt, int batchSize, A[] arg0, B[] arg1)
{
    checkBounds(arg0, arg1, batchStartsAt, batchSize);
    final long finalSequence = sequencer.next(batchSize);
    translateAndPublishBatch(translator, arg0, arg1, batchStartsAt, batchSize, finalSequence);
}
项目:learn_jstorm    文件:RingBuffer.java   
/**
 * Allows two user supplied arguments per event.
 *
 * @param translator    The user specified translation for the event
 * @param batchStartsAt The first element of the array which is within the batch.
 * @param batchSize     The actual size of the batch.
 * @param arg0          An array of user supplied arguments, one element per event.
 * @param arg1          An array of user supplied arguments, one element per event.
 * @see #publishEvents(EventTranslator[])
 */
public <A, B> void publishEvents(EventTranslatorTwoArg<E, A, B> translator, int batchStartsAt, int batchSize, A[] arg0, B[] arg1)
{
    checkBounds(arg0, arg1, batchStartsAt, batchSize);
    final long finalSequence = sequencer.next(batchSize);
    translateAndPublishBatch(translator, arg0, arg1, batchStartsAt, batchSize, finalSequence);
}
项目:jstrom    文件:RingBuffer.java   
/**
 * Allows two user supplied arguments per event.
 * 
 * @param translator The user specified translation for the event
 * @param batchStartsAt The first element of the array which is within the batch.
 * @param batchSize The actual size of the batch.
 * @param arg0 An array of user supplied arguments, one element per event.
 * @param arg1 An array of user supplied arguments, one element per event.
 * @return true if the value was published, false if there was insufficient capacity.
 * @see #tryPublishEvents(EventTranslator[])
 */
public <A, B> boolean tryPublishEvents(EventTranslatorTwoArg<E, A, B> translator, int batchStartsAt, int batchSize, A[] arg0, B[] arg1) {
    checkBounds(arg0, arg1, batchStartsAt, batchSize);
    try {
        final long finalSequence = sequencer.tryNext(batchSize);
        translateAndPublishBatch(translator, arg0, arg1, batchStartsAt, batchSize, finalSequence);
        return true;
    } catch (InsufficientCapacityException e) {
        return false;
    }
}
项目:Tstream    文件:RingBuffer.java   
/**
 * Allows two user supplied arguments per event.
 *
 * @param translator    The user specified translation for the event
 * @param batchStartsAt The first element of the array which is within the batch.
 * @param batchSize     The actual size of the batch.
 * @param arg0          An array of user supplied arguments, one element per event.
 * @param arg1          An array of user supplied arguments, one element per event.
 * @see #publishEvents(EventTranslator[])
 */
public <A, B> void publishEvents(EventTranslatorTwoArg<E, A, B> translator, int batchStartsAt, int batchSize, A[] arg0, B[] arg1)
{
    checkBounds(arg0, arg1, batchStartsAt, batchSize);
    final long finalSequence = sequencer.next(batchSize);
    translateAndPublishBatch(translator, arg0, arg1, batchStartsAt, batchSize, finalSequence);
}
项目:jstorm    文件:RingBuffer.java   
/**
 * Allows two user supplied arguments per event.
 * 
 * @param translator The user specified translation for the event
 * @param batchStartsAt The first element of the array which is within the batch.
 * @param batchSize The actual size of the batch.
 * @param arg0 An array of user supplied arguments, one element per event.
 * @param arg1 An array of user supplied arguments, one element per event.
 * @return true if the value was published, false if there was insufficient capacity.
 * @see #tryPublishEvents(EventTranslator[])
 */
public <A, B> boolean tryPublishEvents(EventTranslatorTwoArg<E, A, B> translator, int batchStartsAt, int batchSize, A[] arg0, B[] arg1) {
    checkBounds(arg0, arg1, batchStartsAt, batchSize);
    try {
        final long finalSequence = sequencer.tryNext(batchSize);
        translateAndPublishBatch(translator, arg0, arg1, batchStartsAt, batchSize, finalSequence);
        return true;
    } catch (InsufficientCapacityException e) {
        return false;
    }
}
项目:jstorm-0.9.6.3-    文件:RingBuffer.java   
/**
 * Allows two user supplied arguments.
 *
 * @see #publishEvent(EventTranslator)
 * @param translator The user specified translation for the event
 * @param arg0 A user supplied argument.
 * @param arg1 A user supplied argument.
 */
public <A, B> void publishEvent(EventTranslatorTwoArg<E, A, B> translator, A arg0, B arg1)
{
    final long sequence = sequencer.next();
    translateAndPublish(translator, sequence, arg0, arg1);
}
项目:jstorm-0.9.6.3-    文件:RingBuffer.java   
/**
 * Allows two user supplied arguments per event.
 *
 * @param translator The user specified translation for the event
 * @param arg0       An array of user supplied arguments, one element per event.
 * @param arg1       An array of user supplied arguments, one element per event.
 * @see #publishEvents(com.lmax.disruptor.EventTranslator[])
 */
public <A, B> void publishEvents(EventTranslatorTwoArg<E, A, B> translator, A[] arg0, B[] arg1)
{
    publishEvents(translator, 0, arg0.length, arg0, arg1);
}
项目:jstorm-0.9.6.3-    文件:RingBuffer.java   
/**
 * Allows two user supplied arguments per event.
 *
 * @param translator The user specified translation for the event
 * @param arg0       An array of user supplied arguments, one element per event.
 * @param arg1       An array of user supplied arguments, one element per event.
 * @return true if the value was published, false if there was insufficient
 *         capacity.
 * @see #tryPublishEvents(com.lmax.disruptor.EventTranslator[])
 */
public <A, B> boolean tryPublishEvents(EventTranslatorTwoArg<E, A, B> translator, A[] arg0, B[] arg1)
{
    return tryPublishEvents(translator, 0, arg0.length, arg0, arg1);
}
项目:learn_jstorm    文件:RingBuffer.java   
/**
 * Allows two user supplied arguments.
 *
 * @see #publishEvent(EventTranslator)
 * @param translator The user specified translation for the event
 * @param arg0 A user supplied argument.
 * @param arg1 A user supplied argument.
 */
public <A, B> void publishEvent(EventTranslatorTwoArg<E, A, B> translator, A arg0, B arg1)
{
    final long sequence = sequencer.next();
    translateAndPublish(translator, sequence, arg0, arg1);
}
项目:learn_jstorm    文件:RingBuffer.java   
/**
 * Allows two user supplied arguments per event.
 *
 * @param translator The user specified translation for the event
 * @param arg0       An array of user supplied arguments, one element per event.
 * @param arg1       An array of user supplied arguments, one element per event.
 * @see #publishEvents(com.lmax.disruptor.EventTranslator[])
 */
public <A, B> void publishEvents(EventTranslatorTwoArg<E, A, B> translator, A[] arg0, B[] arg1)
{
    publishEvents(translator, 0, arg0.length, arg0, arg1);
}
项目:learn_jstorm    文件:RingBuffer.java   
/**
 * Allows two user supplied arguments per event.
 *
 * @param translator The user specified translation for the event
 * @param arg0       An array of user supplied arguments, one element per event.
 * @param arg1       An array of user supplied arguments, one element per event.
 * @return true if the value was published, false if there was insufficient
 *         capacity.
 * @see #tryPublishEvents(com.lmax.disruptor.EventTranslator[])
 */
public <A, B> boolean tryPublishEvents(EventTranslatorTwoArg<E, A, B> translator, A[] arg0, B[] arg1)
{
    return tryPublishEvents(translator, 0, arg0.length, arg0, arg1);
}
项目:jstrom    文件:RingBuffer.java   
/**
 * Allows two user supplied arguments.
 * 
 * @see #publishEvent(EventTranslator)
 * @param translator The user specified translation for the event
 * @param arg0 A user supplied argument.
 * @param arg1 A user supplied argument.
 */
public <A, B> void publishEvent(EventTranslatorTwoArg<E, A, B> translator, A arg0, B arg1) {
    final long sequence = sequencer.next();
    translateAndPublish(translator, sequence, arg0, arg1);
}
项目:jstrom    文件:RingBuffer.java   
/**
 * Allows two user supplied arguments per event.
 * 
 * @param translator The user specified translation for the event
 * @param arg0 An array of user supplied arguments, one element per event.
 * @param arg1 An array of user supplied arguments, one element per event.
 * @see #publishEvents(EventTranslator[])
 */
public <A, B> void publishEvents(EventTranslatorTwoArg<E, A, B> translator, A[] arg0, B[] arg1) {
    publishEvents(translator, 0, arg0.length, arg0, arg1);
}
项目:jstrom    文件:RingBuffer.java   
/**
 * Allows two user supplied arguments per event.
 * 
 * @param translator The user specified translation for the event
 * @param batchStartsAt The first element of the array which is within the batch.
 * @param batchSize The actual size of the batch.
 * @param arg0 An array of user supplied arguments, one element per event.
 * @param arg1 An array of user supplied arguments, one element per event.
 * @see #publishEvents(EventTranslator[])
 */
public <A, B> void publishEvents(EventTranslatorTwoArg<E, A, B> translator, int batchStartsAt, int batchSize, A[] arg0, B[] arg1) {
    checkBounds(arg0, arg1, batchStartsAt, batchSize);
    final long finalSequence = sequencer.next(batchSize);
    translateAndPublishBatch(translator, arg0, arg1, batchStartsAt, batchSize, finalSequence);
}
项目:jstrom    文件:RingBuffer.java   
/**
 * Allows two user supplied arguments per event.
 * 
 * @param translator The user specified translation for the event
 * @param arg0 An array of user supplied arguments, one element per event.
 * @param arg1 An array of user supplied arguments, one element per event.
 * @return true if the value was published, false if there was insufficient capacity.
 * @see #tryPublishEvents(EventTranslator[])
 */
public <A, B> boolean tryPublishEvents(EventTranslatorTwoArg<E, A, B> translator, A[] arg0, B[] arg1) {
    return tryPublishEvents(translator, 0, arg0.length, arg0, arg1);
}
项目:Tstream    文件:RingBuffer.java   
/**
 * Allows two user supplied arguments.
 *
 * @see #publishEvent(EventTranslator)
 * @param translator The user specified translation for the event
 * @param arg0 A user supplied argument.
 * @param arg1 A user supplied argument.
 */
public <A, B> void publishEvent(EventTranslatorTwoArg<E, A, B> translator, A arg0, B arg1)
{
    final long sequence = sequencer.next();
    translateAndPublish(translator, sequence, arg0, arg1);
}