|
| 1 | +/* |
| 2 | + * SPDX-License-Identifier: Apache-2.0 |
| 3 | + * Copyright Red Hat Inc. and Hibernate Authors |
| 4 | + */ |
| 5 | +package org.hibernate.action.internal; |
| 6 | + |
| 7 | +import java.lang.invoke.MethodHandles; |
| 8 | +import java.util.Set; |
| 9 | + |
| 10 | +import org.hibernate.Internal; |
| 11 | +import org.hibernate.internal.log.SubSystemLogging; |
| 12 | + |
| 13 | +import org.jboss.logging.BasicLogger; |
| 14 | +import org.jboss.logging.Logger; |
| 15 | +import org.jboss.logging.annotations.LogMessage; |
| 16 | +import org.jboss.logging.annotations.Message; |
| 17 | +import org.jboss.logging.annotations.MessageLogger; |
| 18 | +import org.jboss.logging.annotations.ValidIdRange; |
| 19 | + |
| 20 | +import static org.jboss.logging.Logger.Level.TRACE; |
| 21 | +import static org.jboss.logging.Logger.Level.WARN; |
| 22 | + |
| 23 | +/** |
| 24 | + * Logging related to the action queue. |
| 25 | + */ |
| 26 | +@MessageLogger(projectCode = "HHH") |
| 27 | +@ValidIdRange(min = 90032001, max = 90033000) |
| 28 | +@SubSystemLogging( |
| 29 | + name = ActionLogging.NAME, |
| 30 | + description = "Logging related to the action queue" |
| 31 | +) |
| 32 | +@Internal |
| 33 | +public interface ActionLogging extends BasicLogger { |
| 34 | + String NAME = SubSystemLogging.BASE + ".action"; |
| 35 | + |
| 36 | + ActionLogging ACTION_LOGGER = Logger.getMessageLogger( |
| 37 | + MethodHandles.lookup(), ActionLogging.class, NAME |
| 38 | + ); |
| 39 | + |
| 40 | + int NAMESPACE = 90032000; |
| 41 | + |
| 42 | + @LogMessage(level = TRACE) |
| 43 | + @Message( |
| 44 | + value = "Adding insert with non-nullable, transient entities; insert=[%s], dependencies=[%s]", |
| 45 | + id = NAMESPACE + 1 |
| 46 | + ) |
| 47 | + void addingInsertWithNonNullableTransientEntities(Object insert, String dependenciesLoggableString); |
| 48 | + |
| 49 | + @LogMessage(level = TRACE) |
| 50 | + @Message( |
| 51 | + value = "No entity insert actions have non-nullable, transient entity dependencies", |
| 52 | + id = NAMESPACE + 2 |
| 53 | + ) |
| 54 | + void noEntityInsertActionsHaveNonNullableTransientDependencies(); |
| 55 | + |
| 56 | + @LogMessage(level = WARN) |
| 57 | + @Message( |
| 58 | + id = NAMESPACE + 3, |
| 59 | + value = """ |
| 60 | + Attempting to save one or more entities that have a non-nullable association with an unsaved transient entity. |
| 61 | + The unsaved transient entity must be saved in an operation prior to saving these dependent entities. |
| 62 | + Unsaved transient entity: %s |
| 63 | + Dependent entities: %s |
| 64 | + Non-nullable associations: %s""" |
| 65 | + ) |
| 66 | + void cannotResolveNonNullableTransientDependencies( |
| 67 | + String transientEntityString, |
| 68 | + Set<String> dependentEntityStrings, |
| 69 | + Set<String> nonNullableAssociationPaths); |
| 70 | + |
| 71 | + |
| 72 | + @LogMessage(level = TRACE) |
| 73 | + @Message( |
| 74 | + value = "No unresolved entity inserts that depended on [%s]", |
| 75 | + id = NAMESPACE + 4 |
| 76 | + ) |
| 77 | + void noUnresolvedEntityInsertsThatDependedOn(String entityInfoString); |
| 78 | + |
| 79 | + @LogMessage(level = TRACE) |
| 80 | + @Message( |
| 81 | + value = "Unresolved inserts before resolving [%s]: [%s]", |
| 82 | + id = NAMESPACE + 5 |
| 83 | + ) |
| 84 | + void unresolvedInsertsBeforeResolving(String entityInfoString, String unresolvedState); |
| 85 | + |
| 86 | + @LogMessage(level = TRACE) |
| 87 | + @Message( |
| 88 | + value = "Resolving insert [%s] dependency on [%s]", |
| 89 | + id = NAMESPACE + 6 |
| 90 | + ) |
| 91 | + void resolvingInsertDependencyOn(String dependentInfo, String entityInfo); |
| 92 | + |
| 93 | + @LogMessage(level = TRACE) |
| 94 | + @Message( |
| 95 | + value = "Resolving insert [%s] (only depended on [%s])", |
| 96 | + id = NAMESPACE + 7 |
| 97 | + ) |
| 98 | + void resolvingInsertOnlyDependedOn(Object dependentAction, String entityInfo); |
| 99 | + |
| 100 | + @LogMessage(level = TRACE) |
| 101 | + @Message( |
| 102 | + value = "Unresolved inserts after resolving [%s]: [%s]", |
| 103 | + id = NAMESPACE + 8 |
| 104 | + ) |
| 105 | + void unresolvedInsertsAfterResolving(String entityInfo, String unresolvedState); |
| 106 | + |
| 107 | + @LogMessage(level = TRACE) |
| 108 | + @Message( |
| 109 | + value = "Starting serialization of [%s] unresolved insert entries", |
| 110 | + id = NAMESPACE + 9 |
| 111 | + ) |
| 112 | + void serializingUnresolvedInsertEntries(int queueSize); |
| 113 | + |
| 114 | + @LogMessage(level = TRACE) |
| 115 | + @Message( |
| 116 | + value = "Starting deserialization of [%s] unresolved insert entries", |
| 117 | + id = NAMESPACE + 10 |
| 118 | + ) |
| 119 | + void deserializingUnresolvedInsertEntries(int queueSize); |
| 120 | + |
| 121 | + // ActionQueue |
| 122 | + @LogMessage(level = TRACE) |
| 123 | + @Message( |
| 124 | + value = "Adding an EntityInsertAction for entity of type [%s]", |
| 125 | + id = NAMESPACE + 11 |
| 126 | + ) |
| 127 | + void addingEntityInsertAction(String entityName); |
| 128 | + |
| 129 | + @LogMessage(level = TRACE) |
| 130 | + @Message( |
| 131 | + value = "Executing inserts before finding non-nullable transient entities for early insert: [%s]", |
| 132 | + id = NAMESPACE + 12 |
| 133 | + ) |
| 134 | + void executingInsertsBeforeFindingNonNullableTransientEntitiesForEarlyInsert(Object insertAction); |
| 135 | + |
| 136 | + @LogMessage(level = TRACE) |
| 137 | + @Message( |
| 138 | + value = "Adding insert with no non-nullable, transient entities: [%s]", |
| 139 | + id = NAMESPACE + 13 |
| 140 | + ) |
| 141 | + void addingInsertWithNoNonNullableTransientEntities(Object insertAction); |
| 142 | + |
| 143 | + @LogMessage(level = TRACE) |
| 144 | + @Message( |
| 145 | + value = "Executing insertions before resolved early insert", |
| 146 | + id = NAMESPACE + 14 |
| 147 | + ) |
| 148 | + void executingInsertionsBeforeResolvedEarlyInsert(); |
| 149 | + |
| 150 | + @LogMessage(level = TRACE) |
| 151 | + @Message( |
| 152 | + value = "Executing identity insert immediately", |
| 153 | + id = NAMESPACE + 15 |
| 154 | + ) |
| 155 | + void executingIdentityInsertImmediately(); |
| 156 | + |
| 157 | + @LogMessage(level = TRACE) |
| 158 | + @Message( |
| 159 | + value = "Adding resolved non-early insert action.", |
| 160 | + id = NAMESPACE + 16 |
| 161 | + ) |
| 162 | + void addingResolvedNonEarlyInsertAction(); |
| 163 | + |
| 164 | + @LogMessage(level = TRACE) |
| 165 | + @Message( |
| 166 | + value = "Adding an EntityIdentityInsertAction for entity of type [%s]", |
| 167 | + id = NAMESPACE + 17 |
| 168 | + ) |
| 169 | + void addingEntityIdentityInsertAction(String entityName); |
| 170 | + |
| 171 | + @LogMessage(level = TRACE) |
| 172 | + @Message( |
| 173 | + value = "Changes must be flushed to space: %s", |
| 174 | + id = NAMESPACE + 18 |
| 175 | + ) |
| 176 | + void changesMustBeFlushedToSpace(Object space); |
| 177 | + |
| 178 | + @LogMessage(level = TRACE) |
| 179 | + @Message( |
| 180 | + value = "Serializing action queue", |
| 181 | + id = NAMESPACE + 19 |
| 182 | + ) |
| 183 | + void serializingActionQueue(); |
| 184 | + |
| 185 | + @LogMessage(level = TRACE) |
| 186 | + @Message( |
| 187 | + value = "Deserializing action queue", |
| 188 | + id = NAMESPACE + 20 |
| 189 | + ) |
| 190 | + void deserializingActionQueue(); |
| 191 | + |
| 192 | + @LogMessage(level = TRACE) |
| 193 | + @Message( |
| 194 | + value = "Deserialized [%s] entries", |
| 195 | + id = NAMESPACE + 21 |
| 196 | + ) |
| 197 | + void deserializedEntries(int count); |
| 198 | + |
| 199 | + @LogMessage(level = WARN) |
| 200 | + @Message( |
| 201 | + value = "Batch containing %s statements could not be sorted (might indicate a circular entity relationship)", |
| 202 | + id = NAMESPACE + 22 |
| 203 | + ) |
| 204 | + void batchCouldNotBeSorted(int count); |
| 205 | +} |
0 commit comments