スケジュールされたイベントをシリアル化しようとすると、
java.io.NotSerializableException: org.quartz.impl.StdScheduler
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1180)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1528)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1493)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1528)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1493)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346)
at java.util.ArrayList.writeObject(ArrayList.java:710)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:975)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1480)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
仕事は次のように予定されています
JobDetail job = new JobDetail();
job.setName(jobName);
job.setGroup("my group");
job.setJobClass(Event.class);
SimpleTrigger trigger = new SimpleTrigger();
trigger.setStartTime(new Date(momentInTime.inMillis()));
trigger.setName("trigger" + index);
if (shouldRunOnce()) {
trigger.setRepeatCount(0);
} else {
trigger.setRepeatInterval(repeatFrequency.inMillis());
trigger.setRepeatCount(SimpleTrigger.REPEAT_INDEFINITELY);
}
scheduleManager.getScheduler().scheduleJob(job, trigger);
どうすればこれを回避できますか?