    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 * @version $Id: LockMode.java 1624601 2014-09-12 18:04:36Z oheger $
    034 * @since 2.0
    035 */
    036public enum LockMode
    037{
    038    /**
    039     * Lock mode <em>READ</em>. The object is accessed in a read-only manner.
    040     * Typically, this means that other read locks can be granted while
    041     * concurrent writes are not permitted.
    042     */
    043    READ,
    044
    045    /**
    046     * Lock mode <em>WRITE</em>. The object is updated. This usually means that
    047     * this object is exclusively locked. Attempts of other readers or writers
    048     * will block until the current update operation is complete.
    049     */
    050    WRITE
    051}