protected long index(Commit<Void> commit) { return commit.index(); }
/** * Returns the unique state machine name. * * @return The unique state machine name. */ protected String getServiceName() { return context.serviceName(); }
@Override public void restore(BackupInput reader) { value = reader.readBytes(reader.readInt()); if (value.length == 0) { value = null; } listeners = reader.readObject(); }
@Override public void backup(BackupOutput writer) { byte[] value = this.value; if (value == null) { value = new byte[0]; } writer.writeInt(value.length).writeBytes(value); writer.writeObject(listeners); }
@Override public void backup(BackupOutput output) { output.writeInt(available); output.writeObject(holders, SERIALIZER::encode); output.writeObject(waiterQueue, SERIALIZER::encode); }
@Override public void backup(BackupOutput output) { if (lock != null) { output.writeBoolean(true); output.writeObject(lock); } else { output.writeBoolean(false); } output.writeObject(queue); }
@Override public void backup(BackupOutput writer) { writer.writeObject(map); }
@Override public void restore(BackupInput input) { collection = input.readObject(); }
/** * Returns the current session. * * @return the current session */ protected Session<C> getCurrentSession() { return getSession(context.currentSession().sessionId()); }
/** * Returns the state machine's wall clock. * * @return The state machine's wall clock. */ protected WallClock getWallClock() { return context.wallClock(); }
/** * Returns the unique state machine identifier. * * @return The unique state machine identifier. */ protected PrimitiveId getServiceId() { return context.serviceId(); }
/** * Returns the state machine's clock. * * @return The state machine's clock. */ protected Clock getClock() { return getWallClock(); }
/** * Returns the state machine's logical clock. * * @return The state machine's logical clock. */ protected LogicalClock getLogicalClock() { return context.logicalClock(); }
/** * Returns the state machine's current index. * * @return The state machine's current index. */ protected long getCurrentIndex() { return context.currentIndex(); }
@Override public final byte[] apply(Commit<byte[]> commit) { return executor.apply(commit); }
@Override public void backup(BackupOutput output) { output.writeObject(collection); }