Package org.apache.flume

Examples of org.apache.flume.ChannelException


    @Override
    protected void doPut(Event event) {
      channelCounter.incrementEventPutAttemptCount();
      if(!putList.offer(event)) {
        throw new ChannelException("Put queue for MemoryTransaction of capacity " +
            putList.size() + " full, consider committing more frequently, " +
            "increasing capacity or increasing thread count");
      }
    }
View Full Code Here


    @Override
    protected Event doTake() throws InterruptedException {
      channelCounter.incrementEventTakeAttemptCount();
      if(takeList.remainingCapacity() == 0) {
        throw new ChannelException("Take list for MemoryTransaction, capacity " +
            takeList.size() + " full, consider committing more frequently, " +
            "increasing capacity, or increasing thread count");
      }
      if(!queueStored.tryAcquire(keepAlive, TimeUnit.SECONDS)) {
        return null;
View Full Code Here

    @Override
    protected void doCommit() throws InterruptedException {
      int remainingChange = takeList.size() - putList.size();
      if(remainingChange < 0) {
        if(!queueRemaining.tryAcquire(-remainingChange, keepAlive, TimeUnit.SECONDS)) {
          throw new ChannelException("Space for commit to queue couldn't be acquired" +
              " Sinks are likely not keeping up with sources, or the buffer size is too tight");
        }
      }
      int puts = putList.size();
      int takes = takeList.size();
View Full Code Here

        if (t instanceof Error) {
          LOG.error("Error while writing to required channel: " +
              reqChannel, t);
          throw (Error) t;
        } else {
          throw new ChannelException("Unable to put batch on required " +
              "channel: " + reqChannel, t);
        }
      } finally {
        if (tx != null) {
          tx.close();
View Full Code Here

        if (t instanceof Error) {
          LOG.error("Error while writing to required channel: " +
              reqChannel, t);
          throw (Error) t;
        } else {
          throw new ChannelException("Unable to put event on required " +
              "channel: " + reqChannel, t);
        }
      } finally {
        if (tx != null) {
          tx.close();
View Full Code Here

            byte[] body = new byte[bytes.remaining()];
            bytes.get(body);
            Event event = EventBuilder.withBody(body);

            // process event
            ChannelException ex = null;
            try {
              source.getChannelProcessor().processEvent(event);
            } catch (ChannelException chEx) {
              ex = chEx;
            }

            if (ex == null) {
              counterGroup.incrementAndGet("events.processed");
              numProcessed++;
              writer.write("OK\n");
            } else {
              counterGroup.incrementAndGet("events.failed");
              logger.warn("Error processing event. Exception follows.", ex);
              writer.write("FAILED: " + ex.getMessage() + "\n");
            }
            writer.flush();

            // advance position after data is consumed
            buffer.position(pos + 1); // skip newline
View Full Code Here

      transaction.begin();
    }
    @Override
    protected void doPut(Event event) throws InterruptedException {
      if(!channel.open) {
        throw new ChannelException("Channel not open");
      }
      if(!channel.queueRemaining.tryAcquire(channel.keepAlive, TimeUnit.SECONDS)) {
        throw new ChannelException("Cannot acquire capacity");
      }
      RecoverableMemoryChannelEvent sequencedEvent =
          new RecoverableMemoryChannelEvent(event, channel.nextSequenceID());
      memoryChannel.put(sequencedEvent);
      events.add(sequencedEvent);
View Full Code Here

    }

    @Override
    protected Event doTake() throws InterruptedException {
      if(!channel.open) {
        throw new ChannelException("Channel not open");
      }
      RecoverableMemoryChannelEvent event = (RecoverableMemoryChannelEvent)memoryChannel.take();
      if(event != null) {
        sequenceIds.add(event.sequenceId);
        takes++;
View Full Code Here

    }

    @Override
    protected void doCommit() throws InterruptedException {
      if(!channel.open) {
        throw new ChannelException("Channel not open");
      }
      if(sequenceIds.size() > 0) {
        try {
          channel.commitSequenceID(sequenceIds);
        } catch (IOException e) {
          throw new ChannelException("Unable to commit", e);
        }
      }
      if(!events.isEmpty()) {
        try {
          channel.commitEvents(events);
        } catch (IOException e) {
          throw new ChannelException("Unable to commit", e);
        }
      }
      transaction.commit();
      channel.queueRemaining.release(takes);
    }
View Full Code Here

    openDirectory = new File(directory, "open");
    completeDirectory = new File(directory, "complete");

    if (!openDirectory.mkdirs()) {
      throw new ChannelException("Unable to create open file directory:"
          + openDirectory);
    }

    if (!completeDirectory.mkdirs()) {
      throw new ChannelException("Unable to create complete file directory:"
          + completeDirectory);
    }

    shouldRotate = false;
    isInitialized = true;
View Full Code Here

TOP

Related Classes of org.apache.flume.ChannelException

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.