use of java.io.IOError in project eiger by wlloyd.
the class CommitLogSegment method close.
/**
* Close the segment file.
*/
public void close() {
if (closed)
return;
try {
logFileAccessor.close();
closed = true;
} catch (IOException e) {
throw new IOError(e);
}
}
use of java.io.IOError in project eiger by wlloyd.
the class LazilyCompactedRow method update.
public void update(MessageDigest digest) {
assert !closed;
// no special-case for rows.size == 1, we're actually skipping some bytes here so just
// blindly updating everything wouldn't be correct
DataOutputBuffer out = new DataOutputBuffer();
try {
ColumnFamily.serializer().serializeCFInfo(emptyColumnFamily, out);
out.writeInt(columnCount);
digest.update(out.getData(), 0, out.getLength());
} catch (IOException e) {
throw new IOError(e);
}
Iterator<IColumn> iter = iterator();
while (iter.hasNext()) {
iter.next().updateDigest(digest);
}
close();
}
use of java.io.IOError in project eiger by wlloyd.
the class KeyIterator method computeNext.
protected DecoratedKey<?> computeNext() {
try {
if (in.isEOF())
return endOfData();
DecoratedKey<?> key = SSTableReader.decodeKey(StorageService.getPartitioner(), desc, ByteBufferUtil.readWithShortLength(in));
// skip data position
in.readLong();
return key;
} catch (IOException e) {
throw new IOError(e);
}
}
use of java.io.IOError in project eiger by wlloyd.
the class MessagingService method shutdown.
/**
* Wait for callbacks and don't allow any more to be created (since they could require writing hints)
*/
public void shutdown() {
logger_.info("Waiting for messaging service to quiesce");
// We may need to schedule hints on the mutation stage, so it's erroneous to shut down the mutation stage first
assert !StageManager.getStage(Stage.MUTATION).isShutdown();
// the important part
callbacks.shutdown();
// attempt to humor tests that try to stop and restart MS
try {
for (SocketThread th : socketThreads) th.close();
} catch (IOException e) {
throw new IOError(e);
}
}
use of java.io.IOError in project eiger by wlloyd.
the class Gossiper method sendGossip.
/**
* Returns true if the chosen target was also a seed. False otherwise
*
* @param prod produces a message to send
* @param epSet a set of endpoint from which a random endpoint is chosen.
* @return true if the chosen endpoint is also a seed.
*/
private boolean sendGossip(MessageProducer prod, Set<InetAddress> epSet) {
int size = epSet.size();
if (size < 1)
return false;
/* Generate a random number from 0 -> size */
List<InetAddress> liveEndpoints = new ArrayList<InetAddress>(epSet);
int index = (size == 1) ? 0 : random.nextInt(size);
InetAddress to = liveEndpoints.get(index);
if (logger.isTraceEnabled())
logger.trace("Sending a GossipDigestSynMessage to {} ...", to);
try {
MessagingService.instance().sendOneWay(prod.getMessage(getVersion(to)), to);
} catch (IOException ex) {
throw new IOError(ex);
}
return seeds.contains(to);
}
Aggregations