Пример #1
0
 @Override
 public Timestamp getTimestamp(DeviceId deviceId) {
   if (DID1.equals(deviceId)) {
     return new MastershipBasedTimestamp(1, ticker.getAndIncrement());
   } else if (DID2.equals(deviceId)) {
     return new MastershipBasedTimestamp(2, ticker.getAndIncrement());
   } else {
     throw new IllegalStateException();
   }
 }
Пример #2
0
 @Override
 public boolean isTimestampAvailable(DeviceId deviceId) {
   return DID1.equals(deviceId) || DID2.equals(deviceId);
 }