/** * Creates a new instance. * * @param properties * The properties to load state from. */ public ReplicationState(Map<String, String> properties) { load(properties); }
/** * Creates a new instance. * * @param properties * The properties to load state from. */ public ReplicationState(Map<String, String> properties) { load(properties); }
/** * Loads all state from the provided properties object. * * @param properties * The properties to be read. */ public void load(Map<String, String> properties) { super.load(properties); txnMax = Long.parseLong(properties.get("txnMax")); txnMaxQueried = Long.parseLong(properties.get("txnMaxQueried")); txnActive = fromString(properties.get("txnActiveList")); txnReady = fromString(properties.get("txnReadyList")); }
/** * Loads all state from the provided properties object. * * @param properties * The properties to be read. */ public void load(Map<String, String> properties) { super.load(properties); txnMax = Long.parseLong(properties.get("txnMax")); txnMaxQueried = Long.parseLong(properties.get("txnMaxQueried")); txnActive = fromString(properties.get("txnActiveList")); txnReady = fromString(properties.get("txnReadyList")); }
@Override public ReplicationState getCurrentState() { ReplicationState state = new ReplicationState(); state.load(currentStatePersister.loadMap()); return state; }
@Override public ReplicationState getCurrentState() { ReplicationState state = new ReplicationState(); state.load(currentStatePersister.loadMap()); return state; }
private ReplicationState loadState(File stateFile) { PropertiesPersister persister = new PropertiesPersister(stateFile); ReplicationState state = new ReplicationState(); state.load(persister.loadMap()); return state; }
private ReplicationState getReplicationState(long sequenceNumber) { PropertiesPersister persister = new PropertiesPersister(getStateFile(sequenceNumber)); ReplicationState state = new ReplicationState(); state.load(persister.loadMap()); return state; }
@Override public void initialize(Map<String, Object> metaData) { if (lockObtained) { throw new OsmosisRuntimeException("initialize has already been called"); } // Lock the working directory. fileLock.lock(); lockObtained = true; // Get the replication state from the upstream task. if (!metaData.containsKey(ReplicationState.META_DATA_KEY)) { throw new OsmosisRuntimeException("No replication state has been provided in metadata key " + ReplicationState.META_DATA_KEY + "."); } state = (ReplicationState) metaData.get(ReplicationState.META_DATA_KEY); // Populate the state from the existing state if it exists. if (statePersistor.exists()) { state.load(statePersistor.loadMap()); // The current sequence number must now be incremented. state.setSequenceNumber(state.getSequenceNumber() + 1); if (LOG.isLoggable(Level.FINER)) { LOG.finer("Replication sequence number is " + state.getSequenceNumber() + "."); } } }
@Override public void initialize(Map<String, Object> metaData) { if (lockObtained) { throw new OsmosisRuntimeException("initialize has already been called"); } // Lock the working directory. fileLock.lock(); lockObtained = true; // Get the replication state from the upstream task. if (!metaData.containsKey(ReplicationState.META_DATA_KEY)) { throw new OsmosisRuntimeException("No replication state has been provided in metadata key " + ReplicationState.META_DATA_KEY + "."); } state = (ReplicationState) metaData.get(ReplicationState.META_DATA_KEY); // Populate the state from the existing state if it exists. if (statePersistor.exists()) { state.load(statePersistor.loadMap()); // The current sequence number must now be incremented. state.setSequenceNumber(state.getSequenceNumber() + 1); if (LOG.isLoggable(Level.FINER)) { LOG.finer("Replication sequence number is " + state.getSequenceNumber() + "."); } } }
/** * {@inheritDoc} */ public void initialize(Map<String, Object> metaData) { // Get the replication state from the upstream task. if (!metaData.containsKey(ReplicationState.META_DATA_KEY)) { throw new OsmosisRuntimeException( "No replication state has been provided in metadata key " + ReplicationState.META_DATA_KEY + "."); } currentState = (ReplicationState) metaData.get(ReplicationState.META_DATA_KEY); // Initialise the state from the stored state if it exists and increment // the sequence number. if (stateExists) { currentState.load(storedState); currentState.setSequenceNumber(currentState.getSequenceNumber() + 1); } }