1 package org.apache.ojb.broker.locking; 2 3 /* Copyright 2002-2005 The Apache Software Foundation 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 /** 19 * This interface defines the lock isolation level constants used by 20 * OJB locking api. It contains numeric constants and literal constants 21 * representing all known isolation levels. 22 * <p/> 23 * NOTE: The lock isolation levels are labeled like the database transaction level but 24 * the definition of the levels is different - take care of that. 25 * 26 * @version $Id: IsolationLevels.java,v 1.1 2007-08-24 22:17:41 ewestfal Exp $ 27 */ 28 public interface IsolationLevels 29 { 30 /** 31 * Numeric constant representing an no-op isolation level. 32 * <p/> 33 * The lock manager completely ignores locking. 34 * <p/> 35 * Allows:<br/> 36 * all possible concurrent side-effects<br/> 37 */ 38 public final static int IL_NONE = -1; 39 40 /** 41 * Numeric constant representing the uncommited read isolation level. 42 * <p/> 43 * Obtaining two concurrent write locks on a given object is not 44 * allowed. Obtaining read locks is allowed even if 45 * another transaction is writing to that object 46 * (Thats why this level is also called "dirty reads"). 47 * <p/> 48 * Allows:<br/> 49 * Dirty Reads<br/> 50 * Non-Repeatable Reads<br/> 51 * Phantom Reads<br/> 52 */ 53 public final static int IL_READ_UNCOMMITTED = 2; 54 55 /** 56 * Numeric constant representing the commited read isolation level. 57 * <p/> 58 * Obtaining two concurrent write locks on a given object is not allowed. 59 * Obtaining read locks is allowed only if there is no write lock on 60 * the given object. 61 * <p/> 62 * Allows:<br/> 63 * Non-Repeatable Reads<br/> 64 * Phantom Reads<br/> 65 */ 66 public final static int IL_READ_COMMITTED = 3; 67 68 /** 69 * Numeric constant representing the repeatable read isolation level. 70 * <p/> 71 * As commited reads, but obtaining a write lock on an object that has 72 * been locked for reading by another transaction is not allowed. 73 * <p/> 74 * Allows:<br/> 75 * Phantom Reads<br/> 76 */ 77 public final static int IL_REPEATABLE_READ = 5; 78 79 /** 80 * Numeric constant representing the serializable transactions isolation level. 81 * <p/> 82 * As Repeatable Reads, but it is even not allowed to have multiple 83 * read locks on a given object. 84 * <p/> 85 * Allows:<br/> 86 * -<br/> 87 */ 88 public final static int IL_SERIALIZABLE = 7; 89 90 /** 91 * Numeric constant representing the optimistic locking isolation level. 92 * <p/> 93 * The lock manager does not perform any pessimistic locking action. Normally 94 * it's not needed to declare this isolation level in persistent object metadata, 95 * because OJB will automatically detect an enabled optimistic locking. 96 * <br/> 97 * NOTE: Usage of this isolation level needs an specific optimistic locking 98 * declaration for the specified object. This declaration is <strong>not</strong> 99 * automatically handled by OJB and need setting of configuration properties - see OJB docs. 100 */ 101 public final static int IL_OPTIMISTIC = 4; 102 103 /** 104 * Numeric constant representing the default isolation level used by 105 * OJB - current used default level is {@link #IL_READ_UNCOMMITTED}. 106 */ 107 public final static int IL_DEFAULT = IL_READ_UNCOMMITTED; 108 109 /** 110 * Literal constant representing the uncommited read isolation level. 111 */ 112 public final static String LITERAL_IL_NONE = "none"; 113 114 /** 115 * Literal constant representing the uncommited read isolation level. 116 */ 117 public final static String LITERAL_IL_READ_UNCOMMITTED = "read-uncommitted"; 118 119 /** 120 * Literal constant representing the commited read isolation level. 121 */ 122 public final static String LITERAL_IL_READ_COMMITTED = "read-committed"; 123 124 /** 125 * Literal constant representing the repeatable read isolation level. 126 */ 127 public final static String LITERAL_IL_REPEATABLE_READ = "repeatable-read"; 128 129 /** 130 * Literal constant representing the serializable transactions isolation level. 131 */ 132 public final static String LITERAL_IL_SERIALIZABLE = "serializable"; 133 134 /** 135 * Literal constant representing the optimistic locking isolation level. 136 */ 137 public final static String LITERAL_IL_OPTIMISTIC = "optimistic"; 138 }