当前位置: 首页>>代码示例>>Java>>正文


Java GridUnsafe.allocateInstance方法代码示例

本文整理汇总了Java中org.apache.ignite.internal.util.GridUnsafe.allocateInstance方法的典型用法代码示例。如果您正苦于以下问题:Java GridUnsafe.allocateInstance方法的具体用法?Java GridUnsafe.allocateInstance怎么用?Java GridUnsafe.allocateInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.ignite.internal.util.GridUnsafe的用法示例。


在下文中一共展示了GridUnsafe.allocateInstance方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: create

import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/**
 * Creates settings for specific table.
 *
 * @param cacheName Ignite cache name.
 * @param tableName Cassandra table name.
 * @return settings for target Cassandra table.
 */
private KeyValuePersistenceSettings create(String cacheName, String tableName) {
    PublicKeyValuePersistenceSettings keyValue = cacheSettings.get(cacheName);
    if (keyValue == null) {
        keyValue = new PublicKeyValuePersistenceSettings(null, null, defaultKeySettings, defaultValueSettings);
        cacheSettings.put(cacheName, keyValue);
    }
    try {
        Object instance = GridUnsafe.allocateInstance(KeyValuePersistenceSettings.class);
        set(instance, elvis(keyValue.getTTL(), generalSettings.getTTL()), "ttl");
        set(instance, generalSettings.getKeyspace(), "keyspace");
        set(instance, tableName, "tbl");
        set(instance, elvis(keyValue.getTableOptions(), generalSettings.getTableOptions()), "tblOptions");
        set(instance, generalSettings.getKeyspaceOptions(), "keyspaceOptions");
        set(instance, elvis(keyValue.getKeyPersistenceSettings(), defaultKeySettings), "keyPersistenceSettings");
        set(instance, elvis(keyValue.getValuePersistenceSettings(), defaultValueSettings), "valPersistenceSettings");
        return (KeyValuePersistenceSettings)instance;
    }
    catch (InstantiationException | NoSuchFieldException | IllegalAccessException e) {
        throw new IllegalStateException("Cannot create Settings");
    }
}
 
开发者ID:epam,项目名称:Lagerta,代码行数:29,代码来源:KeyValuePersistenceSettingsRegistry.java

示例2: readHashSet

import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/**
 * Reads {@link HashSet}.
 *
 * @param mapFieldOff Map field offset.
 * @return Set.
 * @throws ClassNotFoundException If class not found.
 * @throws IOException In case of error.
 */
@SuppressWarnings("unchecked")
HashSet<?> readHashSet(long mapFieldOff) throws ClassNotFoundException, IOException {
    try {
        HashSet<Object> set = (HashSet<Object>)GridUnsafe.allocateInstance(HashSet.class);

        handles.assign(set);

        setObject(set, mapFieldOff, readHashMap(true));

        return set;
    }
    catch (InstantiationException e) {
        throw new IOException(e);
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:24,代码来源:OptimizedObjectInputStream.java

示例3: readLinkedHashSet

import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/**
 * Reads {@link LinkedHashSet}.
 *
 * @param mapFieldOff Map field offset.
 * @return Set.
 * @throws ClassNotFoundException If class not found.
 * @throws IOException In case of error.
 */
@SuppressWarnings("unchecked")
LinkedHashSet<?> readLinkedHashSet(long mapFieldOff) throws ClassNotFoundException, IOException {
    try {
        LinkedHashSet<Object> set = (LinkedHashSet<Object>)GridUnsafe.allocateInstance(LinkedHashSet.class);

        handles.assign(set);

        setObject(set, mapFieldOff, readLinkedHashMap(true));

        return set;
    }
    catch (InstantiationException e) {
        throw new IOException(e);
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:24,代码来源:OptimizedObjectInputStream.java

示例4: newInstance

import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/**
 * @return Instance.
 * @throws BinaryObjectException In case of error.
 */
private Object newInstance() throws BinaryObjectException {
    try {
        return ctor != null ? ctor.newInstance() : GridUnsafe.allocateInstance(cls);
    }
    catch (InstantiationException | InvocationTargetException | IllegalAccessException e) {
        throw new BinaryObjectException("Failed to instantiate instance: " + cls, e);
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:13,代码来源:BinaryClassDescriptor.java

示例5: allocateInstance0

import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/**
 * @param cls Class to create.
 * @return Instance of class.
 */
@Nullable protected <T> T allocateInstance0(Class<T> cls) {
    try {
        return (T)GridUnsafe.allocateInstance(cls);
    }
    catch (InstantiationException e) {
        e.printStackTrace();

        return null;
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:15,代码来源:GridAbstractTest.java

示例6: allocateInstance

import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/**
 * @param cls Class to create.
 * @return Instance of class.
 * @throws Exception If failed.
 */
protected <T> T allocateInstance(Class<T> cls) throws Exception {
    return (T)GridUnsafe.allocateInstance(cls);
}
 
开发者ID:apache,项目名称:ignite,代码行数:9,代码来源:GridAbstractTest.java


注:本文中的org.apache.ignite.internal.util.GridUnsafe.allocateInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。