Saves the high water mark of a source.
This method has the same functionality as {@link #setHWMScn(String, long)}.

@param source - the source
@param hwm    - the high water mark
160359
public void saveHWMark(String source, long hwm) {
        WaterMarkEntry wmEntry = sourceWaterMarkMap.get(source);
        if (wmEntry != null) {
            wmEntry.setHWMScn(Math.max(hwm, wmEntry.getHWMScn()));
        } else {
            wmEntry = new WaterMarkEntry(source);
            wmEntry.setHWMScn(hwm);

            sourceWaterMarkMap.put(source, wmEntry);
        }
    }
741714
@Override
  public void setActualHighWatermark(WorkUnitState wus) {
    if (Boolean.valueOf(wus.getPropAsBoolean(IS_WATERMARK_WORKUNIT_KEY))) {
      wus.setActualHighWatermark(wus.getWorkunit().getExpectedHighWatermark(MultiKeyValueLongWatermark.class));
    } else {
      wus.setActualHighWatermark(wus.getWorkunit().getExpectedHighWatermark(LongWatermark.class));
    }
  }
97599
public <T> T markCreated(T source) {

		Assert.notNull(source, "Entity must not be null!");

		return touch(source, true);
	}
883430
public void addStreamEscape(Stream source, Location target) {
        StreamEscape streamEscape = new StreamEscape(source, target);
        streamEscapeSet.add(streamEscape);
        if (FindOpenStream.DEBUG) {
            System.out.println("Adding potential stream escape " + streamEscape);
        }
    }
551348
@Override
    public void sign ( byte[] data, int offset, int length, CommonServerMessageBlock request, CommonServerMessageBlock response ) {
        if ( log.isTraceEnabled() ) {
            log.trace("Signing with seq " + this.signSequence);
        }

        ( (ServerMessageBlock) request ).setSignSeq(this.signSequence);
        if ( response != null ) {
            ( (ServerMessageBlock) response ).setSignSeq(this.signSequence + 1);
        }

        try {
            update(this.macSigningKey, 0, this.macSigningKey.length);
            int index = offset + SmbConstants.SIGNATURE_OFFSET;
            for ( int i = 0; i < 8; i++ )
                data[ index + i ] = 0;
            SMBUtil.writeInt4(this.signSequence, data, index);
            update(data, offset, length);
            System.arraycopy(digest(), 0, data, index, 8);
            if ( this.bypass ) {
                this.bypass = false;
                System.arraycopy("BSRSPYL ".getBytes(), 0, data, index, 8);
            }
        }
        catch ( Exception ex ) {
            log.error("Signature failed", ex);
        }
        finally {
            if ( request instanceof SmbComNtCancel ) {
                this.signSequence++;
            }
            else {
                this.signSequence += 2;
            }
        }
    }
487507
public synchronized void save() {
        if (BulkChange.contains(this)) {
            return;
        }
        
        File file = getConfigFile();
        try {
            List<String> allSignatures = new ArrayList<>(whitelistSignaturesFromUserControlledList);
            blacklistSignaturesFromUserControlledList.stream()
                    .map(signature -> "!" + signature)
                    .forEach(allSignatures::add);
            
            FileUtils.writeLines(file, allSignatures);
        } catch (IOException e) {
            LOGGER.log(Level.WARNING, "Failed to save " + file.getAbsolutePath(), e);
        }
    }
760700
public static ByteBuf encodeStringAsUtf8(String source) {
        ByteBuf target = Unpooled.buffer(source.length());
        ByteBufUtil.writeUtf8(target, source);
        return target;
    }
209606
@Override
    public void setAsciiStream(String parameterName, InputStream x) throws SQLException
    {
        checkClosed();
        throw SQLError.noSupport();
    }
302094
function howMuchToRead(n, state) {
  if (n <= 0 || state.length === 0 && state.ended) return 0;
  if (state.objectMode) return 1;
  if (n !== n) {
    // Only flow one buffer at a time
    if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
  }
  // If we're asking for more than the current hwm, then raise the hwm.
  if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
  if (n <= state.length) return n;
  // Don't have enough
  if (!state.ended) {
    state.needReadable = true;
    return 0;
  }
  return state.length;
}
998214
@Override
    protected void setWatermarks(long nextLowWatermark, long nextHighWatermark)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "setWatermarks",
                        new Object[] { new Long(nextLowWatermark), new Long(nextHighWatermark), new Long(referenceStreamCount) });

        super.setWatermarks(nextLowWatermark + referenceStreamCount, nextHighWatermark + referenceStreamCount);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "setWatermarks");
    }
92115
public void track(AcknowledgableWatermark acknowledgableWatermark) {
    if (!_started.get() && _autoStart) {
      start();
    }
    maybeAbort();
    String source = acknowledgableWatermark.getCheckpointableWatermark().getSource();
    Deque<AcknowledgableWatermark> sourceWatermarks = _watermarksMap.get(source);
    if (sourceWatermarks == null) {
      sourceWatermarks = new ConcurrentLinkedDeque<>();
      _watermarksMap.put(source, sourceWatermarks);
    }
    sourceWatermarks.add(acknowledgableWatermark);
    _watermarksInserted.mark();
  }
753426
@Override
  public void preSave(String checkpointId) {
    System.out.println(String.format("Saving spout state at checkpoint %s", checkpointId));
  }
943037
public void saveMonomerCache() throws IOException, MonomerException {
		File f = new File(NOTATION_DIRECTORY);
		if (!f.exists()) {
			f.mkdir();
		}
		MonomerCache cache = new MonomerCache();
		cache.setMonomerDB(getMonomerDB(false));
		cache.setAttachmentDB(getAttachmentDB());
		cache.setSmilesMonomerDB(getSmilesMonomerDB(false));
		serializeMonomerCache(cache, MONOMER_CACHE_FILE_PATH);

		String monomerDbXML = buildMonomerDbXMLFromCache(cache);

		FileOutputStream fos = new FileOutputStream(MONOMER_DB_FILE_PATH);
		fos.write(monomerDbXML.getBytes());
		fos.close();
	}
1151535
public void init(StreamImpl source)
  {
    _disableClose = false;
    _isDisableCloseSource = false;
    _readTime = 0;

    if (_source != null && _source != source) {
      close();
    }

    if (source == null) {
      throw new IllegalArgumentException();
    }

    _source = source;

    if (source.canRead()) {
      if (_tempRead == null) {
        _tempRead = TempBuffer.create();
        _readBuffer = _tempRead.buffer();
      }
    }
    _readOffset = 0;
    _readLength = 0;

    _readEncoding = null;
    _readEncodingName = "ISO-8859-1";
  }
459200
private int writeKnownLengthUncompressed(InputStream message, int messageLength)
      throws IOException {
    if (maxOutboundMessageSize >= 0 && messageLength > maxOutboundMessageSize) {
      throw Status.RESOURCE_EXHAUSTED
          .withDescription(
              String.format("message too large %d > %d", messageLength , maxOutboundMessageSize))
          .asRuntimeException();
    }
    ByteBuffer header = ByteBuffer.wrap(headerScratch);
    header.put(UNCOMPRESSED);
    header.putInt(messageLength);
    // Allocate the initial buffer chunk based on frame header + payload length.
    // Note that the allocator may allocate a buffer larger or smaller than this length
    if (buffer == null) {
      buffer = bufferAllocator.allocate(header.position() + messageLength);
    }
    writeRaw(headerScratch, 0, header.position());
    return writeToOutputStream(message, outputStreamAdapter);
  }
762079
private void updateMinPunctuatedWatermark(Watermark nextWatermark) {
		if (nextWatermark.getTimestamp() > maxWatermarkSoFar) {
			long newMin = Long.MAX_VALUE;

			for (KafkaTopicPartitionState<?> state : subscribedPartitionStates) {
				@SuppressWarnings("unchecked")
				final KafkaTopicPartitionStateWithPunctuatedWatermarks<T, KPH> withWatermarksState =
						(KafkaTopicPartitionStateWithPunctuatedWatermarks<T, KPH>) state;

				newMin = Math.min(newMin, withWatermarksState.getCurrentPartitionWatermark());
			}

			// double-check locking pattern
			if (newMin > maxWatermarkSoFar) {
				synchronized (checkpointLock) {
					if (newMin > maxWatermarkSoFar) {
						maxWatermarkSoFar = newMin;
						sourceContext.emitWatermark(new Watermark(newMin));
					}
				}
			}
		}
	}
513375
public void setSystemMessageSourceUuid(SIBUuid8 value) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "setSystemMessageSourceUuid", value);
        // Clear the cached MessageHandle
        cachedMessageHandle = null;
        // Set the value into the message itself
        if (value != null) {
            jmo.setField(JsHdrAccess.SYSTEMMESSAGESOURCEUUID, value.toByteArray());
        }
        else {
            jmo.setField(JsHdrAccess.SYSTEMMESSAGESOURCEUUID, null);
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "setSystemMessageSourceUuid");
    }