    001/*
    002 * Licensed to the Apache Software Foundation (ASF) under one or more
    003 * contributor license agreements.  See the NOTICE file distributed with
    004 * this work for additional information regarding copyright ownership.
    005 * The ASF licenses this file to You under the Apache License, Version 2.0
    006 * (the "License"); you may not use this file except in compliance with
    007 * the License.  You may obtain a copy of the License at
    008 *
    009 *     https://www.apache.org/licenses/LICENSE-2.0
    010 *
    011 * Unless required by applicable law or agreed to in writing, software
    012 * distributed under the License is distributed on an "AS IS" BASIS,
    013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    014 * See the License for the specific language governing permissions and
    015 * limitations under the License.
    016 */
    017package org.apache.commons.configuration2.sync;
    018
    019/**
    020 * Enumerates how an object is locked for {@link SynchronizerSupport}.
    021 * <p>
    022 * The {@code SynchronizerSupport} interface allows locking an object. This can be done in different ways controlling
    023 * the level of concurrency still possible with the object. One of the constants defined here can be passed in when
    024 * calling the {@code lock()} method of a {@code SynchronizerSupport} object. (Note that at the end of the day it is up
    025 * to a concrete implementation of {@link Synchronizer} how these lock modes are interpreted.)
    026 * </p>
    027 *
    028 * @since 2.0
    029 */
    030public enum LockMode {
    031
    032    /**
    033     * Lock mode <em>READ</em>. The object is accessed in a read-only manner. Typically, this means that other read locks
    034     * can be granted while concurrent writes are not permitted.
    035     */
    036    READ,
    037
    038    /**
    039     * Lock mode <em>WRITE</em>. The object is updated. This usually means that this object is exclusively locked. Attempts
    040     * of other readers or writers will block until the current update operation is complete.
    041     */
    042    WRITE
    043}