Package com.linkedin.databus.client.pub

Examples of com.linkedin.databus.client.pub.ConsumerCallbackResult


  }

  @Override
  protected ConsumerCallbackResult doCall() throws Exception
  {
     ConsumerCallbackResult res =  _consumer.onCheckpoint(_scn);
     return ConsumerCallbackResult.isFailure(res) ? ConsumerCallbackResult.SKIP_CHECKPOINT : res;
  }
View Full Code Here


  private ConsumerCallbackResult submitBatch(long curNanos, boolean barrierBefore,
                                             boolean barrierAfter)
  {
    ++_runCallsCounter;
    ConsumerCallbackResult retValue = ConsumerCallbackResult.SUCCESS;
    if (0 >= curNanos) curNanos = System.nanoTime();
    try
    {
      if (barrierBefore) retValue = flushCallQueue(curNanos);

      if (ConsumerCallbackResult.isSuccess(retValue))
      {
        String batchName = _currentBatch.size() > 0 ? _currentBatch.get(0).getClass().getSimpleName()
                                                    : "";
        for (ConsumerCallable<ConsumerCallbackResult> call: _currentBatch)
        {
          Future<ConsumerCallbackResult> future = _executorService.submit(call);
          _submittedCalls.add(new TimestampedFuture<ConsumerCallbackResult>(call, future,
              batchName, ++_runCallsCounter));

        }
      }
      _currentBatch.clear();

      if (ConsumerCallbackResult.isSuccess(retValue))
      {
        ConsumerCallbackResult retValue2 = barrierAfter ? flushCallQueue(curNanos)
                                                        : cleanUpCallQueue(curNanos);
        retValue = ConsumerCallbackResult.max(retValue, retValue2);
      }
    }
    catch (RuntimeException e)
View Full Code Here

    return retValue;
  }

  private ConsumerCallbackResult cleanUpCallQueue(long curNanos)
  {
    ConsumerCallbackResult result = ConsumerCallbackResult.SUCCESS;
    TimestampedFuture<ConsumerCallbackResult> top = null;
    if (0 > curNanos) curNanos = System.nanoTime();
    long timeoutNanos = _timeBudgetNanos > 0 ? curNanos - _timeBudgetNanos : 0;

    //remove completed or expired calls at the head of the queue
    while ((top = _submittedCalls.peek()) != null &&
           (timeoutNanos >= top.getTimestamp() || top.getFuture().isDone()))
    {
      ConsumerCallbackResult callRes = null;
      if (top.getFuture().isDone())
      {
        callRes = getCallResult(top.getFuture(), top.getCallType(), -1);
      }
      else
View Full Code Here

        throw new TimeoutException("No time remaining in a timeout budget of " +
                                   (_timeBudgetNanos/DbusConstants.NUM_NSECS_IN_MSEC) + " ms");
        // Exception caught below
      }

      ConsumerCallbackResult result =  timeoutNanos < 0 ? future.get()
                                                         : future.get(timeoutNanos, TimeUnit.NANOSECONDS);
      if (result == null)
      {
        result = ConsumerCallbackResult.ERROR;
        _log.error("Client application callback (" + callType + ") returned null");
View Full Code Here

  }

  /** Acts as a barrier for all outstanding calls in the call queue */
  public ConsumerCallbackResult flushCallQueue(long curTime)
  {
    ConsumerCallbackResult result = ConsumerCallbackResult.SUCCESS;
    if (0 >= curTime) curTime = System.nanoTime();

    TimestampedFuture<ConsumerCallbackResult> top = null;
    while (_submittedCalls.size() > 0)
    {
      top = _submittedCalls.peek();
      ConsumerCallbackResult topResult = null;
      Future<ConsumerCallbackResult> topFuture = top.getFuture();

      if (!topFuture.isDone())
      {
        if (0 >= curTime) curTime = System.nanoTime();
View Full Code Here

  }

  @Override
  public ConsumerCallbackResult onEndDataEventSequence(SCN endScn)
  {
    ConsumerCallbackResult result = super.onEndDataEventSequence(endScn);
    return doEndDataEventSequence(endScn, result, false);
  }
View Full Code Here

  }

  @Override
  public ConsumerCallbackResult onDataEvent(DbusEvent e, DbusEventDecoder eventDecoder)
  {
    ConsumerCallbackResult result = super.onDataEvent(e, eventDecoder);
    return doDataEvent(e, eventDecoder, result, false);
  }
View Full Code Here

  }

  @Override
  public ConsumerCallbackResult onCheckpoint(SCN checkpointScn)
  {
    ConsumerCallbackResult result = super.onCheckpoint(checkpointScn);
    return doCheckpoint(checkpointScn, result, false);
  }
View Full Code Here

  }

  @Override
  public ConsumerCallbackResult onEndSource(String source, Schema sourceSchema)
  {
    ConsumerCallbackResult result = super.onEndSource(source, sourceSchema);
    return doEndSource(source, sourceSchema, result, false);
  }
View Full Code Here

  }

  @Override
  public ConsumerCallbackResult onRollback(SCN rollbackScn)
  {
    ConsumerCallbackResult result = super.onRollback(rollbackScn);
    return doRollback(rollbackScn, result, false);
  }
View Full Code Here

TOP

Related Classes of com.linkedin.databus.client.pub.ConsumerCallbackResult

Copyright © 2018 www.massapicom. 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.