org.infinispan.commons.util.Util Java Examples

The following examples show how to use org.infinispan.commons.util.Util. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: InfinispanEmbeddedTestResource.java    From quarkus with Apache License 2.0 5 votes vote down vote up
@Override
public void stop() {
    // Need to clean up persistent file - so tests dont' leak between each other
    String tmpDir = System.getProperty("java.io.tmpdir");
    try {
        Files.walk(Paths.get(tmpDir), 1)
                .filter(Files::isDirectory)
                .filter(p -> p.getFileName().toString().startsWith("quarkus-"))
                .map(Path::toFile)
                .forEach(Util::recursiveFileRemove);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
 
Example #2
Source File: InfinispanClientProducer.java    From quarkus with Apache License 2.0 5 votes vote down vote up
/**
 * This method is designed to be called during static initialization time. This is so we have access to the
 * classes, and thus we can use reflection to find and instantiate any instances we may need
 *
 * @param properties properties file read from hot rod
 * @throws ClassNotFoundException if a class is not actually found that should be present
 */
public static void replaceProperties(Properties properties) throws ClassNotFoundException {
    // If you are changing this method, you will most likely have to change builderFromProperties as well
    String marshallerClassName = (String) properties.get(ConfigurationProperties.MARSHALLER);
    if (marshallerClassName != null) {
        Class<?> marshallerClass = Class.forName(marshallerClassName);
        properties.put(ConfigurationProperties.MARSHALLER, Util.getInstance(marshallerClass));
    } else {
        // Default to proto stream marshaller if one is not provided
        properties.put(ConfigurationProperties.MARSHALLER, new ProtoStreamMarshaller());
    }
}
 
Example #3
Source File: RedisConfigurationProperties.java    From khan-session with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void loadProperties(String configFile) throws IOException {
    ClassLoader cl = Thread.currentThread().getContextClassLoader();

    InputStream stream = cl.getResourceAsStream(configFile);

    if (stream == null) {
        System.err.println("Can't Found configFile=" + configFile);
    } else {
        try {
            properties.load(stream);
        } finally {
            Util.close(stream);
        }
    }
}
 
Example #4
Source File: InfinispanHotRodImpl.java    From khan-session with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * 초기화 함수, 설정파일을 읽어서 캐시를 초기화한다.
 *
 * @param configFile
 * @param cacheName
 * @param loginCacheName
 * @throws IOException
 */
@Override
public void initialize(String configFile, String cacheName, String loginCacheName)
        throws IOException {
    StringUtils.isNotNull("configFile", configFile);

    Configuration configuration = null;
    ConfigurationBuilder builder = new ConfigurationBuilder();
    ClassLoader cl = Thread.currentThread().getContextClassLoader();
    builder.classLoader(cl);

    InputStream stream = cl.getResourceAsStream(configFile);

    if (stream == null) {
        logger.error("Can't Found configFile=" + configFile);
    } else {
        try {
            builder.withProperties(loadFromStream(stream));
        } finally {
            Util.close(stream);
        }
    }
    configuration = builder.build();


    cacheManager = new RemoteCacheManager(configuration);

    cache = cacheManager.getCache(cacheName);
    loginCache = cacheManager.getCache(loginCacheName);

    waitForConnectionReady();
}
 
Example #5
Source File: TestAdvancedExternalizer.java    From quarkus with Apache License 2.0 4 votes vote down vote up
@Override
public Set<Class<? extends IdViaConfigObj>> getTypeClasses() {
    return Util.<Class<? extends IdViaConfigObj>> asSet(IdViaConfigObj.class);
}
 
Example #6
Source File: TestAdvancedExternalizer.java    From quarkus with Apache License 2.0 4 votes vote down vote up
@Override
public Set<Class<? extends IdViaAnnotationObj>> getTypeClasses() {
    return Util.<Class<? extends IdViaAnnotationObj>> asSet(IdViaAnnotationObj.class);
}
 
Example #7
Source File: TestAdvancedExternalizer.java    From quarkus with Apache License 2.0 4 votes vote down vote up
@Override
public Set<Class<? extends IdViaBothObj>> getTypeClasses() {
    return Util.<Class<? extends IdViaBothObj>> asSet(IdViaBothObj.class);
}
 
Example #8
Source File: HAKieSessionDeltaFact.java    From hacep with Apache License 2.0 4 votes vote down vote up
@Override
public Set<Class<? extends HAKieSessionDeltaFact>> getTypeClasses() {
    return Util.asSet(HAKieSessionDeltaFact.class);
}
 
Example #9
Source File: HAKieSessionDeltaEmpty.java    From hacep with Apache License 2.0 4 votes vote down vote up
@Override
public Set<Class<? extends HAKieSessionDeltaEmpty>> getTypeClasses() {
    return Util.asSet(HAKieSessionDeltaEmpty.class);
}