@Override public void read(DataInput in) throws IOException { try { long msb = in.readLong(); long lsb = in.readLong(); this.token = new UUID(msb, lsb); } catch (Exception e) { throw new UnknownStoreVersionException(e); } if (!token.equals(JobSchedulerStoreImpl.SCHEDULER_STORE_TOKEN)) { throw new UnknownStoreVersionException(token.toString()); } this.version = in.readInt(); if (in.readBoolean()) { setLastUpdateLocation(LocationMarshaller.INSTANCE.readPayload(in)); } else { setLastUpdateLocation(null); } this.storedSchedulers = new BTreeIndex<String, JobSchedulerImpl>(store.getPageFile(), in.readLong()); this.storedSchedulers.setKeyMarshaller(StringMarshaller.INSTANCE); this.storedSchedulers.setValueMarshaller(new JobSchedulerMarshaller(this.store)); this.journalRC = new BTreeIndex<Integer, Integer>(store.getPageFile(), in.readLong()); this.journalRC.setKeyMarshaller(IntegerMarshaller.INSTANCE); this.journalRC.setValueMarshaller(IntegerMarshaller.INSTANCE); this.removeLocationTracker = new BTreeIndex<Integer, List<Integer>>(store.getPageFile(), in.readLong()); this.removeLocationTracker.setKeyMarshaller(IntegerMarshaller.INSTANCE); this.removeLocationTracker.setValueMarshaller(new IntegerListMarshaller()); LOG.info("Scheduler Store version {} loaded", this.version); }
@Override public void initialize(Transaction tx) throws IOException { this.storedSchedulers = new BTreeIndex<String, JobSchedulerImpl>(store.getPageFile(), tx.allocate().getPageId()); this.journalRC = new BTreeIndex<Integer, Integer>(store.getPageFile(), tx.allocate().getPageId()); this.removeLocationTracker = new BTreeIndex<Integer, List<Integer>>(store.getPageFile(), tx.allocate().getPageId()); }