Example #1
0
 public BufferInfo loadBufferInfo() {
   try {
     return new BufferInfo(
         api.path(routes.BuffersResource().utilization(), BuffersResponse.class)
             .node(this)
             .execute());
   } catch (Exception e) {
     LOG.error("Unable to read buffer info from node " + this, e);
   }
   return BufferInfo.buildEmpty();
 }
Example #2
0
  private CellNodeBuffer alloc(int size, boolean playable) {
    CellNodeBuffer current = null;
    for (BufferInfo i : _allBuffers) {
      if (i.mapSize >= size) {
        for (CellNodeBuffer buf : i.bufs) {
          if (buf.lock()) {
            i.uses++;
            if (playable) {
              i.playableUses++;
            }
            i.elapsed += buf.getElapsedTime();
            current = buf;
            break;
          }
        }
        if (current != null) {
          break;
        }

        // not found, allocate temporary buffer
        current = new CellNodeBuffer(i.mapSize);
        current.lock();
        if (i.bufs.size() < i.count) {
          i.bufs.add(current);
          i.uses++;
          if (playable) {
            i.playableUses++;
          }
          break;
        }

        i.overflows++;
        if (playable) {
          i.playableOverflows++;
          // System.err.println("Overflow, size requested: " + size + " playable:"+playable);
        }
      }
    }

    return current;
  }