この質問はmy another SO questionに関連しています。分割ステップの期間オープンIndexWriterを保つためにSpring BatchのExecutionContextに対してLucene IndexWriterをシリアライズできますか?
は、私がStepExecutionListenerSupport
のafterStep(StepExecution stepExecution)
方法で近いその後、パーティショナのExecutionContext
にIndexWriter
を追加すると考えられます。
私がこのアプローチで直面している挑戦は、ExecutionContext
がオブジェクトをシリアライズ可能にする必要があるということです。これら二つの質問の光、Q1で
、Q2からIndexWriter
が持っていないので、私のカスタム・ライターでコンストラクタARG無 - - コンストラクタARG私は何を追加することはできませんので、それが実現可能なようではありません。上記のコードで
public class CustomIndexWriter extends IndexWriter implements Serializable {
/*
private Directory d;
private IndexWriterConfig conf;
public CustomIndexWriter(){
super();
super(this.d, this.conf);
}
*/
public CustomIndexWriter(Directory d, IndexWriterConfig conf) throws IOException {
super(d, conf);
}
/**
*
*/
private static final long serialVersionUID = 1L;
private void readObject(ObjectInputStream input) throws IOException, ClassNotFoundException{
input.defaultReadObject();
}
private void writeObject(ObjectOutputStream output) throws IOException, ClassNotFoundException {
output.defaultWriteObject();
}
}
ないので、私はコメントとして示さコンストラクタを追加することはできません - 引数コンストラクタは、スーパークラス内に存在しないとsuper
this
前のフィールドにアクセスすることはできません。
これを達成する方法はありますか?
'indexWriter'クラスに' super(); 'はありません。 –
私が言っているのは、 'IndexWriter'は引数なしのコンストラクタを持たないため、' super() 'のコードはコンパイルされないということです。それが私がコメントした理由です。 –
自分のコードをもう一度見て、アナライザーが必要です。 それはsuper(lDirectory、analyzer)になります。 私の投稿を編集させてください。 – SimonC