public static SslContext createNettySslContextForClient(boolean allowInsecureConnection, String trustCertsFilePath) throws GeneralSecurityException, SSLException, FileNotFoundException, IOException { return createNettySslContextForClient(allowInsecureConnection, trustCertsFilePath, (Certificate[]) null, (PrivateKey) null); }
@Override public void run() { renew(); } }, this.rateTime, this.rateTime, this.timeUnit);
public static SSLContext createSslContext(boolean allowInsecureConnection, String trustCertsFilePath, String certFilePath, String keyFilePath) throws GeneralSecurityException { X509Certificate[] trustCertificates = loadCertificatesFromPemFile(trustCertsFilePath); X509Certificate[] certificates = loadCertificatesFromPemFile(certFilePath); PrivateKey privateKey = loadPrivateKeyFromPemFile(keyFilePath); return createSslContext(allowInsecureConnection, trustCertificates, certificates, privateKey); }
public static FunctionStatus decode(String json) throws IOException { return ObjectMapperFactory.getThreadLocal().readValue(json, FunctionStatus.class); } }
public static SslContext createNettySslContextForClient(boolean allowInsecureConnection, String trustCertsFilePath, String certFilePath, String keyFilePath) throws GeneralSecurityException, SSLException, FileNotFoundException, IOException { X509Certificate[] certificates = loadCertificatesFromPemFile(certFilePath); PrivateKey privateKey = loadPrivateKeyFromPemFile(keyFilePath); return createNettySslContextForClient(allowInsecureConnection, trustCertsFilePath, certificates, privateKey); }
@Override protected ObjectMapper initialValue() throws Exception { return create(); } };
@Override public CompletableFuture<Void> seekAsync(MessageId messageId) { return FutureUtil.failedFuture(new PulsarClientException("Seek operation not supported on topics consumer")); }
/** * @return a String representing the current datetime */ public static String now() { return format(Instant.now()); }
public static SSLContext createSslContext(boolean allowInsecureConnection, Certificate[] trustCertificates) throws GeneralSecurityException { return createSslContext(allowInsecureConnection, trustCertificates, (Certificate[]) null, (PrivateKey) null); }
public String getEncodedLocalName() { return Codec.encode(localName); }
public static SSLContext createSslContext(boolean allowInsecureConnection, Certificate[] trustCertficates, Certificate[] certificates, PrivateKey privateKey) throws GeneralSecurityException { KeyStoreHolder ksh = new KeyStoreHolder(); TrustManager[] trustManagers = null; KeyManager[] keyManagers = null; trustManagers = setupTrustCerts(ksh, allowInsecureConnection, trustCertficates); keyManagers = setupKeyManager(ksh, privateKey, certificates); SSLContext sslCtx = SSLContext.getInstance("TLS"); sslCtx.init(keyManagers, trustManagers, new SecureRandom()); sslCtx.getDefaultSSLParameters(); return sslCtx; }
public SimpleTextOutputStream write(boolean b) { write(b ? "true" : "false"); return this; }
/** * Acquires permits from this {@link RateLimiter} if it can be acquired immediately without delay. * * <p> * This method is equivalent to {@code tryAcquire(1)}. * * @param permits * the number of permits to acquire * @return {@code true} if the permits were acquired, {@code false} otherwise */ public synchronized boolean tryAcquire() { return tryAcquire(1); }
public static SslContext createNettySslContextForClient(boolean allowInsecureConnection, String trustCertsFilePath, Certificate[] certificates, PrivateKey privateKey) throws GeneralSecurityException, SSLException, FileNotFoundException, IOException { SslContextBuilder builder = SslContextBuilder.forClient(); setupTrustCerts(builder, allowInsecureConnection, trustCertsFilePath); setupKeyManager(builder, privateKey, (X509Certificate[]) certificates); return builder.build(); }
/** * Acquires the given number of permits from this {@code RateLimiter}, blocking until the request be granted. * * This method is equivalent to {@code acquire(1)}. * * @param permits * the number of permits to acquire */ public synchronized void acquire() throws InterruptedException { acquire(1); }
@Override protected ObjectMapper initialValue() throws Exception { return createYaml(); } };
public SimpleTextOutputStream write(long n) { NumberFormat.format(this.buffer, n); return this; }
/** * Converts String to float. * * @param value * The String to be converted. * @return The converted Double value. */ public static Float stringToFloat(String val) { return Float.valueOf(trim(val)); }
public static Map<String, String> configureFromJsonString(String authParamsString) throws IOException { ObjectMapper jsonMapper = ObjectMapperFactory.create(); return jsonMapper.readValue(authParamsString, new TypeReference<HashMap<String, String>>() { }); }
/** * @return a String representing a particular timestamp (in milliseconds) */ public static String format(long timestamp) { return format(Instant.ofEpochMilli(timestamp)); }