private void blacklist(KestrelClientInfo info, Throwable t) { // this case can happen when it fails to connect to Kestrel (and so // never stores the connection) info.closeClient(); info.blacklistTillTimeMs = System.currentTimeMillis() + BLACKLIST_TIME_MS; final int index = _kestrels.indexOf(info); // we just closed the connection, so all open reliable reads will be // aborted. empty buffers. for (final Iterator<EmitItem> i = _emitBuffer.iterator(); i.hasNext();) { final EmitItem item = i.next(); if (item.sourceId.index == index) i.remove(); } }
List<Item> items = null; try { items = info.getValidClient().get(_queueName, BATCH_SIZE, 0, _messageTimeoutMillis);
List<Item> items = null; try { items = info.getValidClient().get(_queueName, BATCH_SIZE, 0, _messageTimeoutMillis);
@SuppressWarnings("rawtypes") @Override public void open(Map conf, TopologyContext context, SpoutOutputCollector collector) { // TODO: should switch this to maxTopologyMessageTimeout final Number timeout = (Number) conf.get(Config.TOPOLOGY_MESSAGE_TIMEOUT_SECS); _messageTimeoutMillis = 1000 * timeout.intValue(); _collector = collector; _emitIndex = 0; _kestrels = new ArrayList<KestrelClientInfo>(); final int numTasks = context.getComponentTasks(context.getThisComponentId()).size(); final int myIndex = context.getThisTaskIndex(); final int numHosts = _hosts.size(); if (numTasks < numHosts) { for (final String host : _hosts) { _kestrels.add(new KestrelClientInfo(host, _port)); } } else { final String host = _hosts.get(myIndex % numHosts); _kestrels.add(new KestrelClientInfo(host, _port)); } }
@SuppressWarnings("rawtypes") @Override public void open(Map conf, TopologyContext context, SpoutOutputCollector collector) { // TODO: should switch this to maxTopologyMessageTimeout final Number timeout = (Number) conf.get(Config.TOPOLOGY_MESSAGE_TIMEOUT_SECS); _messageTimeoutMillis = 1000 * timeout.intValue(); _collector = collector; _emitIndex = 0; _kestrels = new ArrayList<KestrelClientInfo>(); final int numTasks = context.getComponentTasks(context.getThisComponentId()).size(); final int myIndex = context.getThisTaskIndex(); final int numHosts = _hosts.size(); if (numTasks < numHosts) { for (final String host : _hosts) { _kestrels.add(new KestrelClientInfo(host, _port)); } } else { final String host = _hosts.get(myIndex % numHosts); _kestrels.add(new KestrelClientInfo(host, _port)); } }
private void blacklist(KestrelClientInfo info, Throwable t) { // this case can happen when it fails to connect to Kestrel (and so // never stores the connection) info.closeClient(); info.blacklistTillTimeMs = System.currentTimeMillis() + BLACKLIST_TIME_MS; final int index = _kestrels.indexOf(info); // we just closed the connection, so all open reliable reads will be // aborted. empty buffers. for (final Iterator<EmitItem> i = _emitBuffer.iterator(); i.hasNext();) { final EmitItem item = i.next(); if (item.sourceId.index == index) i.remove(); } }
@Override public void close() { for (final KestrelClientInfo info : _kestrels) info.closeClient(); // Closing the client connection causes all the open reliable reads to // be aborted. // Thus, clear our local buffer of these reliable reads. _emitBuffer.clear(); _kestrels.clear(); }
@Override public void close() { for (final KestrelClientInfo info : _kestrels) info.closeClient(); // Closing the client connection causes all the open reliable reads to // be aborted. // Thus, clear our local buffer of these reliable reads. _emitBuffer.clear(); _kestrels.clear(); }