Py学习  »  Elasticsearch

从“org.elasticsearch.client”序列化RestHighLevelClient

Nagendra • 4 年前 • 285 次点击  

我想从elastic序列化RestHighLevelClient。下面是我的代码

 import org.elasticsearch.client.RestHighLevelClient
 @Component
 public class Client implements Serializable {
  private transient RestHighLevelClient client;
  @PostContruct
  private void init() {
  //code to initialize RestHighLevelClient 
  }
}
private void writeObject(ObjectOutputStream oos) throws Exception {
 oos.defaultWriteObject();
 oos.writeObject(client); 
}
private void readObject(ObjectInputStream ois) throws Exception 
{ 
  ois.defaultReadObject(); 
  client= (RestHighLevelClient)ois.readObject(); 
} 

我已经写了readObject和writeObject来序列化,但它没有按预期工作。关于如何序列化它有什么线索吗?

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/50393
 
285 次点击