use of org.iplass.mtp.MtpException in project iPLAss by ISID.
the class RedisCacheStoreFactory method inited.
@Override
public void inited(CacheService service, Config config) {
RedisService rs = config.getDependentService(RedisService.class);
server = rs.getRedisServer(serverName);
if (server == null) {
throw new MtpException("Unknown redis server name: " + serverName);
}
ClientResources resouces = DefaultClientResources.builder().build();
RedisURI.Builder uriBuilder = RedisURI.builder().withHost(server.getHost()).withPort(server.getPort());
if (server.getTimeout() > 0) {
uriBuilder.withTimeout(Duration.ofSeconds(server.getTimeout()));
}
client = RedisClient.create(resouces, uriBuilder.build());
}
use of org.iplass.mtp.MtpException in project iPLAss by ISID.
the class RedisCacheStoreBase method encodeBase64.
protected String encodeBase64(Object obj) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try (ObjectOutputStream bis = new ObjectOutputStream(baos)) {
bis.writeObject(obj);
bis.flush();
return Base64.getEncoder().encodeToString(baos.toByteArray());
} catch (IOException e) {
throw new MtpException(e);
}
}
Aggregations