小编Cai*_*ain的帖子

禁止:禁止更新除“副本”、“模板”和“更新策略”以外的字段的 statefulset 规范

我使用 io.fabric8.kubernetes-client, version 3.1.8 来做 kubernetes 资源的 RollingUpdate。用于部署很好。但是我遇到了 StatefulSet 的例外。但是如果我对 StatefulSet 使用 'kubectl apply -f ***.yaml' 也很好。

滚动更新部署的代码:

public void createOrReplaceResourceByYaml(String namespace, KubernetesResource resource) {
  KubernetesClient client = k8sRestClient.newKubeClient();
  Deployment deployment = (Deployment) resource;
  logger.info(String.format("Create/Replace Deployment [%s] in namespace [%s].", ((Deployment) resource).getMetadata().getName(), namespace));
  NonNamespaceOperation<Deployment, DeploymentList, DoneableDeployment, ScalableResource<Deployment, DoneableDeployment>> deployments = client.extensions().deployments().inNamespace(namespace);
  Deployment result = deployments.createOrReplace(deployment);
  logger.info(String.format("Created/Replaced Deployment [%s].", result.getMetadata().getName()));
}
Run Code Online (Sandbox Code Playgroud)

滚动更新 StatefulSet 的代码

public void createOrReplaceResourceByYaml(String namespace, KubernetesResource resource) {
  KubernetesClient client = k8sRestClient.newKubeClient();
  StatefulSet statefulSet = (StatefulSet) resource;
  logger.info(String.format("Create/Replace …
Run Code Online (Sandbox Code Playgroud)

java fabric8 kubernetes

6
推荐指数
2
解决办法
2万
查看次数

如何让javamail支持http代理

我发现javamail只支持socks。有什么解决方案可以用来支持 http 代理吗?

public class MailConnectionTest {
 public static void main(String args[]) throws MessagingException {
   Properties props = MailConnectionTest.getProperties();
   Session session = Session.getDefaultInstance(props, null);
   String protocol = "pop3";
   String host = "pop.163.com";
   String username = "email username";
   String password = "1Qaz2wsx3edc&";
   Store store = session.getStore(protocol);
   store.connect(host, username, password);
   System.out.println("Success");
}
private static Properties getProperties() {
 Properties props = System.getProperties();
 props.put("mail.debug", "false");
 // Proxy
 props.put("proxySet", "true");
 props.put("http.proxyHost", "proxyAdderss");
 props.put("http.proxyPort", "8080");
 return props;
}
}
Run Code Online (Sandbox Code Playgroud)

java jakarta-mail http-proxy

2
推荐指数
1
解决办法
6271
查看次数

使用Java Mail保存附件时如何加快时间?

我将Message msg分成Multipart multi1 =(Multipart)msg.getContent()。邮件附件位于一个BodyPart中,Part part = multi1.getBodyPart(i); 然后我要保存附件。

private void saveFile(String fileName, InputStream in) throws IOException {
File file = new File(fileName);
if (!file.exists()) {
  OutputStream out = null;
  try {
    out = new BufferedOutputStream(new FileOutputStream(file));
    in = new BufferedInputStream(in);
    byte[] buf = new byte[BUFFSIZE];
    int len;
    while ((len = in.read(buf)) > 0) {
      out.write(buf, 0, len);
    }
  } catch (FileNotFoundException e) {
    LOG.error(e.toString());
  } finally {
    // close streams
    if (in != null) { …
Run Code Online (Sandbox Code Playgroud)

io performance jakarta-mail

1
推荐指数
1
解决办法
1187
查看次数

标签 统计

jakarta-mail ×2

java ×2

fabric8 ×1

http-proxy ×1

io ×1

kubernetes ×1

performance ×1