Example usage for java.io IOError IOError

List of usage examples for java.io IOError IOError

Introduction

In this page you can find the example usage for java.io IOError IOError.

Prototype

public IOError(Throwable cause) 

Source Link

Document

Constructs a new instance of IOError with the specified cause.

Usage

From source file:ca.mcgill.cs.crown.data.WiktionaryReader.java

private List<JSONObject> extract(IWiktionaryEdition wikt, File outputFile) {
    try {/*w  ww.  jav a  2  s.com*/
        return extract_(wikt, outputFile);
    } catch (Exception e) {
        // Ugh... lazy
        throw new IOError(e);
    }
}

From source file:gov.llnl.ontology.mapreduce.table.WordNetEvidenceTable.java

/**
 * {@inheritDoc}/*  w w  w. j  a  v a2  s . c om*/
 */
public void createTable() {
    try {
        Configuration conf = HBaseConfiguration.create();
        HConnection connector = HConnectionManager.getConnection(conf);
        createTable(connector);
    } catch (IOException ioe) {
        throw new IOError(ioe);
    }
}

From source file:org.apache.cassandra.service.MigrationManager.java

private static void pushSchemaMutation(InetAddress endpoint, Collection<RowMutation> schema) {
    try {/* www.  jav a 2  s .  c o  m*/
        Message msg = makeMigrationMessage(schema, Gossiper.instance.getVersion(endpoint));
        MessagingService.instance().sendOneWay(msg, endpoint);
    } catch (IOException ex) {
        throw new IOError(ex);
    }
}

From source file:com.bigdata.dastor.io.SSTableReader.java

private static MappedByteBuffer mmap(String filename, long start, int size) throws IOException {
    RandomAccessFile raf;//from  w  ww .j  av  a  2s  . co  m
    try {
        raf = new RandomAccessFile(filename, "r");
    } catch (FileNotFoundException e) {
        throw new IOError(e);
    }

    try {
        return raf.getChannel().map(FileChannel.MapMode.READ_ONLY, start, size);
    } finally {
        raf.close();
    }
}

From source file:gov.llnl.ontology.mapreduce.table.TrinidadTable.java

/**
 * {@inheritDoc}/*from   w w  w .  ja va2  s  . c  o  m*/
 */
public void createTable(HConnection connector) {
    try {
        Configuration config = HBaseConfiguration.create();
        HBaseAdmin admin = new HBaseAdmin(config);

        // Do nothing if the table already exists.
        if (admin.tableExists(tableName()))
            return;

        HTableDescriptor docDesc = new HTableDescriptor(tableName());
        SchemaUtil.addDefaultColumnFamily(docDesc, SOURCE_CF);
        SchemaUtil.addDefaultColumnFamily(docDesc, TEXT_CF);
        SchemaUtil.addDefaultColumnFamily(docDesc, ANNOTATION_CF);
        SchemaUtil.addDefaultColumnFamily(docDesc, LABEL_CF);
        SchemaUtil.addDefaultColumnFamily(docDesc, META_CF);
        admin.createTable(docDesc);
    } catch (IOException ioe) {
        throw new IOError(ioe);
    }
}

From source file:gov.llnl.ontology.mapreduce.table.WordNetEvidenceTable.java

/**
 * {@inheritDoc}/*from w w  w  .j  ava2 s .  c  o m*/
 */
public void createTable(HConnection connector) {
    try {
        // Create configuration and admin classes.
        Configuration config = HBaseConfiguration.create();
        HBaseAdmin admin = new HBaseAdmin(config);

        // Do nothing if the table already exists.
        if (admin.tableExists(TABLE_NAME))
            return;

        // Add the column families to the table.
        HTableDescriptor desc = new HTableDescriptor(TABLE_NAME);
        SchemaUtil.addDefaultColumnFamily(desc, NOUN_PAIR_CF);
        SchemaUtil.addDefaultColumnFamily(desc, DEPENDENCY_FEATURE_CF);
        SchemaUtil.addDefaultColumnFamily(desc, SIMILARITY_CF);
        SchemaUtil.addDefaultColumnFamily(desc, CLASS_CF);
        admin.createTable(desc);
    } catch (IOException ioe) {
        throw new IOError(ioe);
    }
}

From source file:gov.llnl.ontology.mapreduce.table.TrinidadTable.java

/**
 * {@inheritDoc}//from  ww w.  j  a v  a2  s  .  c o m
 */
public Iterator<Result> iterator(Scan scan) {
    try {
        return table.getScanner(scan).iterator();
    } catch (IOException ioe) {
        throw new IOError(ioe);
    }
}

From source file:org.apache.cassandra.db.Table.java

private Table(String table) {
    name = table;//from   w w w  .j  ava2s.c  o m
    indexLocks = new Object[DatabaseDescriptor.getConcurrentWriters() * 8];
    for (int i = 0; i < indexLocks.length; i++)
        indexLocks[i] = new Object();
    // create data directories.
    for (String dataDir : DatabaseDescriptor.getAllDataFileLocations()) {
        try {
            String keyspaceDir = dataDir + File.separator + table;
            FileUtils.createDirectory(keyspaceDir);

            // remove the deprecated streaming directory.
            File streamingDir = new File(keyspaceDir, "stream");
            if (streamingDir.exists())
                FileUtils.deleteRecursive(streamingDir);
        } catch (IOException ex) {
            throw new IOError(ex);
        }
    }

    for (CFMetaData cfm : new ArrayList<CFMetaData>(
            DatabaseDescriptor.getTableDefinition(table).cfMetaData().values())) {
        ColumnFamilyStore cfs = ColumnFamilyStore.createColumnFamilyStore(table, cfm.cfName);
        columnFamilyStores.put(cfm.cfId, cfs);
    }

    // check 10x as often as the lifetime, so we can exceed lifetime by 10% at most
    int checkMs = DatabaseDescriptor.getMemtableLifetimeMS() / 10;
    flushTask = new TimerTask() {
        public void run() {
            for (ColumnFamilyStore cfs : columnFamilyStores.values()) {
                cfs.forceFlushIfExpired();
            }
        }
    };
    flushTimer.schedule(flushTask, checkMs, checkMs);
}

From source file:gov.llnl.ontology.mapreduce.table.TrinidadTable.java

/**
 * {@inheritDoc}// w  w  w.  j  a  va  2 s . c o  m
 */
public HTable table() {
    try {
        table = new HTable(HBaseConfiguration.create(), tableName());
    } catch (IOException ioe) {
        throw new IOError(ioe);
    }
    return table;
}

From source file:gov.llnl.ontology.mapreduce.table.WordNetEvidenceTable.java

/**
 * {@inheritDoc}//from w ww. jav  a2 s .c o  m
 */
public HTable table() {
    try {
        if (table == null)
            table = new HTable(TABLE_NAME);
        return table;
    } catch (IOException ioe) {
        throw new IOError(ioe);
    }
}