Search in sources :

Example 41 with IOError

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);
    }
}
Also used : IOError(java.io.IOError) IOException(java.io.IOException)

Example 42 with IOError

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();
}
Also used : IOError(java.io.IOError) DataOutputBuffer(org.apache.cassandra.io.util.DataOutputBuffer) IOException(java.io.IOException)

Example 43 with IOError

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);
    }
}
Also used : IOError(java.io.IOError) IOException(java.io.IOException)

Example 44 with IOError

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);
    }
}
Also used : IOError(java.io.IOError) IOException(java.io.IOException)

Example 45 with IOError

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);
}
Also used : IOError(java.io.IOError) IOException(java.io.IOException) InetAddress(java.net.InetAddress)

Aggregations

IOError (java.io.IOError)50 IOException (java.io.IOException)43 File (java.io.File)8 DataInputStream (java.io.DataInputStream)5 ByteArrayInputStream (java.io.ByteArrayInputStream)4 Console (java.io.Console)4 IPartitioner (org.apache.cassandra.dht.IPartitioner)4 FastByteArrayInputStream (org.apache.cassandra.io.util.FastByteArrayInputStream)4 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3 InputStream (java.io.InputStream)3 ArrayList (java.util.ArrayList)3 QueryPath (org.apache.cassandra.db.filter.QueryPath)3 SshClient (org.apache.sshd.client.SshClient)3 UserInteraction (org.apache.sshd.client.auth.keyboard.UserInteraction)3 ClientChannel (org.apache.sshd.client.channel.ClientChannel)3 ClientSession (org.apache.sshd.client.session.ClientSession)3 BufferedReader (java.io.BufferedReader)2 FileInputStream (java.io.FileInputStream)2 InputStreamReader (java.io.InputStreamReader)2 PrintWriter (java.io.PrintWriter)2