コード例 #1
0
  @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);
  }
コード例 #2
0
 @Override
 public void write(DataOutput out) throws IOException {
   out.writeLong(this.token.getMostSignificantBits());
   out.writeLong(this.token.getLeastSignificantBits());
   out.writeInt(this.version);
   if (getLastUpdateLocation() != null) {
     out.writeBoolean(true);
     LocationMarshaller.INSTANCE.writePayload(getLastUpdateLocation(), out);
   } else {
     out.writeBoolean(false);
   }
   out.writeLong(this.storedSchedulers.getPageId());
   out.writeLong(this.journalRC.getPageId());
   out.writeLong(this.removeLocationTracker.getPageId());
 }