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 *     http://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 * <p>
021 * An enumeration used by {@link SynchronizerSupport} to specify how an object
022 * is locked.
023 * </p>
024 * <p>
025 * The {@code SynchronizerSupport} interface allows locking an object. This can
026 * be done in different ways controlling the level of concurrency still possible
027 * with the object. One of the constants defined here can be passed in when
028 * calling the {@code lock()} method of a {@code SynchronizerSupport} object.
029 * (Note that at the end of the day it is up to a concrete implementation of
030 * {@link Synchronizer} how these lock modes are interpreted.)
031 * </p>
032 *
033 * @since 2.0
034 */
035public enum LockMode
036{
037    /**
038     * Lock mode <em>READ</em>. The object is accessed in a read-only manner.
039     * Typically, this means that other read locks can be granted while
040     * concurrent writes are not permitted.
041     */
042    READ,
043
044    /**
045     * Lock mode <em>WRITE</em>. The object is updated. This usually means that
046     * this object is exclusively locked. Attempts of other readers or writers
047     * will block until the current update operation is complete.
048     */
049    WRITE
050}