/** * @see stream.io.Sink#write(stream.Data) */ @Override public boolean write(Data item) throws Exception { return insert(item); }
public Data take() { try { return read(); } catch (Exception e) { e.printStackTrace(); return null; } }
/** * @see stream.io.QueueService#level() */ @Override public int level() { return size(); }
/** * @see stream.io.Source#init() */ @Override public void init() throws Exception { if (getCapacity() < 1) throw new IllegalArgumentException("Invalid queue-capacity '" + getCapacity() + "'!"); if (index == null || index.isEmpty()) throw new IllegalArgumentException("Index is not specified"); if (streams == null || streams.size() == 0) throw new IllegalArgumentException("Index is not specified"); if (sync == null || sync.isEmpty()) throw new IllegalArgumentException("Index is not specified"); for (String unit : streams) { queues.put(unit, new SnappyBlockingQueue(capacity)); } reads = streams.size(); readQueue = new String[reads]; dataQueue = new Data[reads]; accs = new long[reads]; int j = 0; for (String unit : streams) { readQueue[j] = unit; j++; } }
/** * @see stream.io.Source#init() */ @Override public void init() throws Exception { if (getCapacity() < 1) throw new IllegalArgumentException("Invalid queue-capacity '" + getCapacity() + "'!"); if (index == null || index.isEmpty()) throw new IllegalArgumentException("Index is not specified"); if (streams == null || streams.size() == 0) throw new IllegalArgumentException("Index is not specified"); if (sync == null || sync.isEmpty()) throw new IllegalArgumentException("Index is not specified"); for (String unit : streams) { queues.put(unit, new SnappyBlockingQueue(capacity)); } reads = streams.size(); readQueue = new String[reads]; dataQueue = new Data[reads]; accs = new long[reads]; int j = 0; for (String unit : streams) { readQueue[j] = unit; j++; } }
/** * @see stream.io.QueueService#level() */ @Override public int level() { return size(); }
/** * @see stream.io.Sink#write(stream.Data) */ @Override public boolean write(Data item) throws Exception { return insert(item); }
public Data take() { try { return read(); } catch (Exception e) { e.printStackTrace(); return null; } }
@Override public Integer getSize() { return size(); }
@Override public Integer getSize() { return size(); }
public int remainingCapacity() { return capacity - size(); }
public int remainingCapacity() { return capacity - size(); }