mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-22 15:10:02 +00:00
Use AppLog and System.Logger for logging - static imports
This commit is contained in:
1 parent
a23f241fff
commit
4252445eb4
73 files changed
+473
-416
No files matched your search
+6
-4
@@ -9,12 +9,14 @@ import io.ebean.config.CurrentTenantProvider;
|
||||
import io.ebean.meta.MetricVisitor;
|
||||
import io.ebean.util.AnnotationUtil;
|
||||
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentSkipListSet;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import static java.lang.System.Logger.Level.DEBUG;
|
||||
import static java.lang.System.Logger.Level.TRACE;
|
||||
|
||||
/**
|
||||
* Manages the construction of caches.
|
||||
*/
|
||||
@@ -89,7 +91,7 @@ final class DefaultCacheHolder {
|
||||
}
|
||||
|
||||
void clearAll() {
|
||||
log.log(Level.DEBUG, "clearAll");
|
||||
log.log(DEBUG, "clearAll");
|
||||
for (ServerCache serverCache : allCaches.values()) {
|
||||
serverCache.clear();
|
||||
}
|
||||
@@ -97,7 +99,7 @@ final class DefaultCacheHolder {
|
||||
|
||||
|
||||
public void clear(String name) {
|
||||
log.log(Level.DEBUG, "clear {0}", name);
|
||||
log.log(DEBUG, "clear {0}", name);
|
||||
clearIfExists(key(name, ServerCacheType.QUERY));
|
||||
clearIfExists(key(name, ServerCacheType.BEAN));
|
||||
clearIfExists(key(name, ServerCacheType.NATURAL_KEY));
|
||||
@@ -112,7 +114,7 @@ final class DefaultCacheHolder {
|
||||
private void clearIfExists(String fullKey) {
|
||||
ServerCache cache = allCaches.get(fullKey);
|
||||
if (cache != null) {
|
||||
log.log(Level.TRACE, "clear cache {0}", fullKey);
|
||||
log.log(TRACE, "clear cache {0}", fullKey);
|
||||
cache.clear();
|
||||
}
|
||||
}
|
||||
|
||||
+6
-4
@@ -9,13 +9,15 @@ import io.ebean.metric.CountMetric;
|
||||
import io.ebean.metric.MetricFactory;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.lang.ref.SoftReference;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import static java.lang.System.Logger.Level.TRACE;
|
||||
import static java.lang.System.Logger.Level.WARNING;
|
||||
|
||||
/**
|
||||
* The default cache implementation.
|
||||
* <p>
|
||||
@@ -287,13 +289,13 @@ public class DefaultServerCache implements ServerCache {
|
||||
evictCount.add(trimmedByGC);
|
||||
evictCount.add(trimmedByTTL);
|
||||
evictCount.add(trimmedByLRU);
|
||||
if (logger.isLoggable(Level.TRACE)) {
|
||||
if (logger.isLoggable(TRACE)) {
|
||||
long exeMicros = TimeUnit.MICROSECONDS.convert(System.nanoTime() - startNanos, TimeUnit.NANOSECONDS);
|
||||
logger.log(Level.TRACE, "Executed trim of cache {0} in [{1}]millis idle[{2}] timeToLive[{3}] accessTime[{4}] gc[{5}]",
|
||||
logger.log(TRACE, "Executed trim of cache {0} in [{1}]millis idle[{2}] timeToLive[{3}] accessTime[{4}] gc[{5}]",
|
||||
name, exeMicros, trimmedByIdle, trimmedByTTL, trimmedByLRU, trimmedByGC);
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
logger.log(Level.WARNING, "Error during trim of DefaultServerCache [" + name + "]. Cache might be bigger than desired.", e);
|
||||
logger.log(WARNING, "Error during trim of DefaultServerCache [" + name + "]. Cache might be bigger than desired.", e);
|
||||
}
|
||||
} finally {
|
||||
lock.unlock();
|
||||
|
||||
+7
-5
@@ -9,9 +9,11 @@ import io.ebeaninternal.api.SpiCacheRegion;
|
||||
import io.ebeaninternal.server.cluster.ClusterManager;
|
||||
import io.ebeaninternal.server.deploy.DCacheRegion;
|
||||
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.*;
|
||||
|
||||
import static java.lang.System.Logger.Level.DEBUG;
|
||||
import static java.lang.System.Logger.Level.INFO;
|
||||
|
||||
/**
|
||||
* Manages the bean and query caches.
|
||||
*/
|
||||
@@ -65,23 +67,23 @@ public final class DefaultServerCacheManager implements SpiCacheManager {
|
||||
enabled.add(region.name());
|
||||
if (!region.isEnabled()) {
|
||||
region.setEnabled(true);
|
||||
log.log(Level.DEBUG, "Cache region[{0}] enabled", region.name());
|
||||
log.log(DEBUG, "Cache region[{0}] enabled", region.name());
|
||||
}
|
||||
} else {
|
||||
disabled.add(region.name());
|
||||
if (region.isEnabled()) {
|
||||
region.setEnabled(false);
|
||||
log.log(Level.DEBUG, "Cache region[{0}] disabled", region.name());
|
||||
log.log(DEBUG, "Cache region[{0}] disabled", region.name());
|
||||
}
|
||||
}
|
||||
}
|
||||
log.log(Level.INFO, "Cache regions enabled:{0} disabled:{1}", enabled, disabled);
|
||||
log.log(INFO, "Cache regions enabled:{0} disabled:{1}", enabled, disabled);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAllRegionsEnabled(boolean enabled) {
|
||||
log.log(Level.DEBUG, "All cache regions enabled[{0}]", enabled);
|
||||
log.log(DEBUG, "All cache regions enabled[{0}]", enabled);
|
||||
for (SpiCacheRegion region : regionMap.values()) {
|
||||
region.setEnabled(enabled);
|
||||
}
|
||||
|
||||
+5
-3
@@ -10,9 +10,11 @@ import io.ebean.plugin.SpiServer;
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
|
||||
import java.io.StringWriter;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.Properties;
|
||||
|
||||
import static java.lang.System.Logger.Level.ERROR;
|
||||
import static java.lang.System.Logger.Level.INFO;
|
||||
|
||||
/**
|
||||
* Simply logs the change sets in JSON form to logger named <code>io.ebean.ChangeLog</code>.
|
||||
*/
|
||||
@@ -65,9 +67,9 @@ public final class DefaultChangeLogListener implements ChangeLogListener, Plugin
|
||||
try {
|
||||
StringWriter writer = new StringWriter(getBufferSize(beanChange));
|
||||
jsonBuilder.writeBeanJson(writer, beanChange, changeSet);
|
||||
changeLog.log(Level.INFO, writer.toString());
|
||||
changeLog.log(INFO, writer.toString());
|
||||
} catch (Exception e) {
|
||||
CoreLog.log.log(Level.ERROR, "Exception logging beanChange " + beanChange, e);
|
||||
CoreLog.log.log(ERROR, "Exception logging beanChange " + beanChange, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,12 +5,13 @@ import io.ebean.Database;
|
||||
import io.ebean.config.ContainerConfig;
|
||||
import io.ebeaninternal.server.transaction.RemoteTransactionEvent;
|
||||
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.Iterator;
|
||||
import java.util.ServiceLoader;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import static java.lang.System.Logger.Level.DEBUG;
|
||||
|
||||
/**
|
||||
* Manages the cluster service.
|
||||
*/
|
||||
@@ -112,8 +113,8 @@ public class ClusterManager implements ServerLookup {
|
||||
*/
|
||||
public void broadcast(RemoteTransactionEvent event) {
|
||||
if (broadcast != null) {
|
||||
if (clusterLogger.isLoggable(Level.DEBUG)) {
|
||||
clusterLogger.log(Level.DEBUG, "sending: {0}", event);
|
||||
if (clusterLogger.isLoggable(DEBUG)) {
|
||||
clusterLogger.log(DEBUG, "sending: {0}", event);
|
||||
}
|
||||
broadcast.broadcast(event);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import io.ebeaninternal.api.SpiEbeanServer;
|
||||
import io.ebeaninternal.api.SpiTransaction;
|
||||
import io.ebeaninternal.server.core.timezone.DataTimeZone;
|
||||
|
||||
import java.lang.System.Logger.Level;
|
||||
import static java.lang.System.Logger.Level.ERROR;
|
||||
|
||||
/**
|
||||
* Base class for find and persist requests.
|
||||
@@ -63,7 +63,7 @@ public abstract class BeanRequest {
|
||||
// Just log this and carry on. A previous exception has been
|
||||
// thrown and if this rollback throws exception it likely means
|
||||
// that the connection is broken (and the dataSource and db will cleanup)
|
||||
CoreLog.log.log(Level.ERROR, "Error trying to rollback a transaction (after a prior exception thrown)", e);
|
||||
CoreLog.log.log(ERROR, "Error trying to rollback a transaction (after a prior exception thrown)", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import io.ebeaninternal.api.DbOffline;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
import javax.sql.DataSource;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.SQLException;
|
||||
@@ -16,6 +15,9 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.ServiceLoader;
|
||||
|
||||
import static java.lang.System.Logger.Level.DEBUG;
|
||||
import static java.lang.System.Logger.Level.INFO;
|
||||
|
||||
/**
|
||||
* Create a DatabasePlatform from the configuration.
|
||||
* <p>
|
||||
@@ -39,7 +41,7 @@ public class DatabasePlatformFactory {
|
||||
try {
|
||||
String offlinePlatform = DbOffline.getPlatform();
|
||||
if (offlinePlatform != null) {
|
||||
CoreLog.log.log(Level.INFO, "offline platform [{0}]", offlinePlatform);
|
||||
CoreLog.log.log(INFO, "offline platform [{0}]", offlinePlatform);
|
||||
return byDatabaseName(offlinePlatform);
|
||||
}
|
||||
if (config.getDatabasePlatformName() != null) {
|
||||
@@ -88,7 +90,7 @@ public class DatabasePlatformFactory {
|
||||
String dbProductName = metaData.getDatabaseProductName().toLowerCase();
|
||||
final int majorVersion = metaData.getDatabaseMajorVersion();
|
||||
final int minorVersion = metaData.getDatabaseMinorVersion();
|
||||
CoreLog.log.log(Level.DEBUG, "platform for productName[{0}] version[{1}.{2}]", dbProductName, majorVersion, minorVersion);
|
||||
CoreLog.log.log(DEBUG, "platform for productName[{0}] version[{1}.{2}]", dbProductName, majorVersion, minorVersion);
|
||||
for (DatabasePlatformProvider provider : providers) {
|
||||
if (provider.matchByProductName(dbProductName)) {
|
||||
return provider.create(majorVersion, minorVersion, metaData, connection);
|
||||
|
||||
@@ -14,10 +14,11 @@ import io.ebeaninternal.server.deploy.BeanPropertyAssocMany;
|
||||
import io.ebeaninternal.server.transaction.DefaultPersistenceContext;
|
||||
|
||||
import javax.persistence.EntityNotFoundException;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static java.lang.System.Logger.Level.DEBUG;
|
||||
|
||||
/**
|
||||
* Helper to handle lazy loading and refreshing of beans.
|
||||
*/
|
||||
@@ -108,8 +109,8 @@ final class DefaultBeanLoader {
|
||||
server.findOne(query, null);
|
||||
if (beanCollection != null) {
|
||||
if (beanCollection.checkEmptyLazyLoad()) {
|
||||
if (log.isLoggable(Level.DEBUG)) {
|
||||
log.log(Level.DEBUG, "BeanCollection after load was empty. Owner:" + beanCollection.getOwnerBean());
|
||||
if (log.isLoggable(DEBUG)) {
|
||||
log.log(DEBUG, "BeanCollection after load was empty. Owner:" + beanCollection.getOwnerBean());
|
||||
}
|
||||
} else if (useManyIdCache) {
|
||||
parentDesc.cacheManyPropPut(many, beanCollection, parentId);
|
||||
|
||||
@@ -14,7 +14,6 @@ import io.ebeaninternal.server.core.bootup.BootupClasses;
|
||||
import io.ebeaninternal.server.executor.DefaultBackgroundExecutor;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.net.URL;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
@@ -22,6 +21,8 @@ import java.util.List;
|
||||
import java.util.ServiceLoader;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import static java.lang.System.Logger.Level.*;
|
||||
|
||||
/**
|
||||
* Default Server side implementation of ServerFactory.
|
||||
*/
|
||||
@@ -107,7 +108,7 @@ public final class DefaultContainer implements SpiContainer {
|
||||
startServer(online, server);
|
||||
}
|
||||
DbOffline.reset();
|
||||
log.log(Level.INFO, "Started database[{0}] platform[{1}] in {2}ms", config.getName(), config.getDatabasePlatform().getPlatform(), System.currentTimeMillis() - start);
|
||||
log.log(INFO, "Started database[{0}] platform[{1}] in {2}ms", config.getName(), config.getDatabasePlatform().getPlatform(), System.currentTimeMillis() - start);
|
||||
return server;
|
||||
} finally {
|
||||
lock.unlock();
|
||||
@@ -136,7 +137,7 @@ public final class DefaultContainer implements SpiContainer {
|
||||
private void checkMissingModulePathProvides() {
|
||||
URL servicesFile = ClassLoader.getSystemResource("META-INF/services/io.ebean.config.EntityClassRegister");
|
||||
if (servicesFile != null) {
|
||||
log.log(Level.ERROR, "module-info.java is probably missing 'provides io.ebean.config.EntityClassRegister with EbeanEntityRegister' clause. EntityClassRegister exists but was not service loaded.");
|
||||
log.log(ERROR, "module-info.java is probably missing 'provides io.ebean.config.EntityClassRegister with EbeanEntityRegister' clause. EntityClassRegister exists but was not service loaded.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,7 +215,7 @@ public final class DefaultContainer implements SpiContainer {
|
||||
*/
|
||||
private void setDataSource(DatabaseConfig config) {
|
||||
if (isOfflineMode(config)) {
|
||||
log.log(Level.DEBUG, "... DbOffline using platform [{0}]", DbOffline.getPlatform());
|
||||
log.log(DEBUG, "... DbOffline using platform [{0}]", DbOffline.getPlatform());
|
||||
} else {
|
||||
InitDataSource.init(config);
|
||||
}
|
||||
@@ -250,7 +251,7 @@ public final class DefaultContainer implements SpiContainer {
|
||||
}
|
||||
try (Connection connection = config.getDataSource().getConnection()) {
|
||||
if (connection.getAutoCommit()) {
|
||||
log.log(Level.WARNING, "DataSource [{0}] has autoCommit defaulting to true!", config.getName());
|
||||
log.log(WARNING, "DataSource [{0}] has autoCommit defaulting to true!", config.getName());
|
||||
}
|
||||
return true;
|
||||
} catch (SQLException ex) {
|
||||
|
||||
@@ -51,7 +51,6 @@ import javax.persistence.NonUniqueResultException;
|
||||
import javax.persistence.OptimisticLockException;
|
||||
import javax.persistence.PersistenceException;
|
||||
import javax.sql.DataSource;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
@@ -65,6 +64,7 @@ import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static java.lang.System.Logger.Level.*;
|
||||
import static java.util.Spliterators.spliteratorUnknownSize;
|
||||
import static java.util.stream.StreamSupport.stream;
|
||||
|
||||
@@ -331,7 +331,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
if (config.isQueryPlanCapture()) {
|
||||
long secs = config.getQueryPlanCapturePeriodSecs();
|
||||
if (secs > 10) {
|
||||
log.log(Level.INFO, "capture query plan enabled, every {0}secs", secs);
|
||||
log.log(INFO, "capture query plan enabled, every {0}secs", secs);
|
||||
backgroundExecutor.scheduleWithFixedDelay(this::collectQueryPlans, secs, secs, TimeUnit.SECONDS);
|
||||
}
|
||||
}
|
||||
@@ -379,7 +379,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
* Shutdown the services like threads and DataSource.
|
||||
*/
|
||||
private void shutdownInternal(boolean shutdownDataSource, boolean deregisterDriver) {
|
||||
log.log(Level.TRACE, "shutting down instance {0}", serverName);
|
||||
log.log(TRACE, "shutting down instance {0}", serverName);
|
||||
if (shutdown) {
|
||||
// already shutdown
|
||||
return;
|
||||
@@ -408,7 +408,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
try {
|
||||
plugin.shutdown();
|
||||
} catch (Exception e) {
|
||||
log.log(Level.ERROR, "Error when shutting down plugin", e);
|
||||
log.log(ERROR, "Error when shutting down plugin", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2075,7 +2075,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
try {
|
||||
serverCacheManager.clearLocal(Class.forName(cache));
|
||||
} catch (Exception e) {
|
||||
log.log(Level.ERROR, "Error clearing local cache for type " + cache, e);
|
||||
log.log(ERROR, "Error clearing local cache for type " + cache, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,11 +6,12 @@ import io.ebeaninternal.xmapping.api.XmapDto;
|
||||
import io.ebeaninternal.xmapping.api.XmapEbean;
|
||||
import io.ebeaninternal.xmapping.api.XmapRawSql;
|
||||
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static java.lang.System.Logger.Level.ERROR;
|
||||
|
||||
/**
|
||||
* Reads the Xml deployment information.
|
||||
*/
|
||||
@@ -56,7 +57,7 @@ final class InternalConfigXmlMap {
|
||||
try {
|
||||
dtoClass = Class.forName(dto.getClazz(), false, classLoader);
|
||||
} catch (Exception e) {
|
||||
CoreLog.internal.log(Level.ERROR, "Could not load dto bean class " + dto.getClazz() + " for ebean xml entry");
|
||||
CoreLog.internal.log(ERROR, "Could not load dto bean class " + dto.getClazz() + " for ebean xml entry");
|
||||
return;
|
||||
}
|
||||
DtoNamedQueries namedQueries = dtoNamedQueries.computeIfAbsent(dtoClass, aClass -> new DtoNamedQueries());
|
||||
|
||||
@@ -57,9 +57,10 @@ import io.ebeanservice.docstore.api.DocStoreIntegration;
|
||||
import io.ebeanservice.docstore.api.DocStoreUpdateProcessor;
|
||||
import io.ebeanservice.docstore.none.NoneDocStoreFactory;
|
||||
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.*;
|
||||
|
||||
import static java.lang.System.Logger.Level.*;
|
||||
|
||||
/**
|
||||
* Used to extend the DatabaseConfig with additional objects used to configure and
|
||||
* construct an Database.
|
||||
@@ -433,7 +434,7 @@ public final class InternalConfiguration {
|
||||
externalTransactionManager = new JtaTransactionManager();
|
||||
}
|
||||
if (externalTransactionManager != null) {
|
||||
log.log(Level.INFO, "Using Transaction Manager {0}", externalTransactionManager.getClass());
|
||||
log.log(INFO, "Using Transaction Manager {0}", externalTransactionManager.getClass());
|
||||
return new ExternalTransactionScopeManager(externalTransactionManager);
|
||||
} else {
|
||||
return new DefaultTransactionScopeManager();
|
||||
@@ -523,7 +524,7 @@ public final class InternalConfiguration {
|
||||
if (iterator.hasNext()) {
|
||||
// use the cacheFactory (via classpath service loader)
|
||||
plugin = iterator.next();
|
||||
log.log(Level.DEBUG, "using ServerCacheFactory {0}", plugin.getClass());
|
||||
log.log(DEBUG, "using ServerCacheFactory {0}", plugin.getClass());
|
||||
} else {
|
||||
// use the built in default l2 caching which is local cache based
|
||||
localL2Caching = true;
|
||||
@@ -613,7 +614,7 @@ public final class InternalConfiguration {
|
||||
@Override
|
||||
public void execute(boolean online) {
|
||||
if (online && ddlRun) {
|
||||
CoreLog.log.log(Level.ERROR, "Configured to run DDL but ebean-ddl-generator is not in the classpath (or ebean-test in the test classpath?)");
|
||||
CoreLog.log.log(ERROR, "Configured to run DDL but ebean-ddl-generator is not in the classpath (or ebean-test in the test classpath?)");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -5,10 +5,11 @@ import io.ebean.config.DatabaseConfig;
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import io.ebeaninternal.server.core.ClassPathScanners;
|
||||
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static java.lang.System.Logger.Level.DEBUG;
|
||||
|
||||
/**
|
||||
* Searches for interesting classes such as Entities, Embedded and ScalarTypes.
|
||||
*/
|
||||
@@ -58,7 +59,7 @@ public class BootupClassPathSearch {
|
||||
}
|
||||
|
||||
long searchTime = System.currentTimeMillis() - st;
|
||||
log.log(Level.DEBUG, "Classpath search entities[{0}] searchTime[{1}] in packages[{2}]", bc.getEntities().size(), searchTime, packages);
|
||||
log.log(DEBUG, "Classpath search entities[{0}] searchTime[{1}] in packages[{2}]", bc.getEntities().size(), searchTime, packages);
|
||||
return bc;
|
||||
|
||||
} catch (Exception ex) {
|
||||
|
||||
@@ -18,13 +18,15 @@ import javax.persistence.AttributeConverter;
|
||||
import javax.persistence.Embeddable;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import static java.lang.System.Logger.Level.DEBUG;
|
||||
import static java.lang.System.Logger.Level.ERROR;
|
||||
|
||||
/**
|
||||
* Interesting classes for a EbeanServer such as Embeddable, Entity,
|
||||
* ScalarTypes, Finders, Listeners and Controllers.
|
||||
@@ -205,13 +207,13 @@ public class BootupClasses implements Predicate<Class<?>> {
|
||||
try {
|
||||
return cls.getConstructor().newInstance();
|
||||
} catch (NoSuchMethodException e) {
|
||||
log.log(Level.DEBUG, "Ignore/expected - no default constructor: " + e.getMessage());
|
||||
log.log(DEBUG, "Ignore/expected - no default constructor: " + e.getMessage());
|
||||
return null;
|
||||
|
||||
} catch (Exception e) {
|
||||
if (logOnException) {
|
||||
// not expected but we log and carry on
|
||||
log.log(Level.ERROR, "Error creating " + cls, e);
|
||||
log.log(ERROR, "Error creating " + cls, e);
|
||||
return null;
|
||||
|
||||
} else {
|
||||
|
||||
@@ -6,7 +6,6 @@ import io.ebeaninternal.util.UrlHelper;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.net.URL;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
@@ -15,6 +14,8 @@ import java.util.Set;
|
||||
import java.util.jar.Attributes;
|
||||
import java.util.jar.Manifest;
|
||||
|
||||
import static java.lang.System.Logger.Level.WARNING;
|
||||
|
||||
/**
|
||||
* Reads all the META-INF/ebean.mf resources with the package locations of entity beans.
|
||||
*/
|
||||
@@ -63,7 +64,7 @@ class ManifestReader {
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.log(Level.WARNING, "Error reading " + resourcePath + " manifest resources", e);
|
||||
log.log(WARNING, "Error reading " + resourcePath + " manifest resources", e);
|
||||
}
|
||||
return packageSet;
|
||||
}
|
||||
|
||||
@@ -58,7 +58,6 @@ import io.ebeanservice.docstore.api.mapping.DocumentMapping;
|
||||
import javax.persistence.PersistenceException;
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Types;
|
||||
@@ -68,6 +67,8 @@ import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static io.ebeaninternal.server.persist.DmlUtil.isNullOrZero;
|
||||
import static java.lang.System.Logger.Level.ERROR;
|
||||
import static java.lang.System.Logger.Level.INFO;
|
||||
|
||||
/**
|
||||
* Describes Beans including their deployment information.
|
||||
@@ -792,7 +793,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
changeJson.flush();
|
||||
return beanChange(ChangeType.UPDATE, request.beanId(), changeJson.newJson(), changeJson.oldJson());
|
||||
} catch (RuntimeException e) {
|
||||
log.log(Level.ERROR, "Failed to write ChangeLog entry for update", e);
|
||||
log.log(ERROR, "Failed to write ChangeLog entry for update", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -808,7 +809,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
jsonWriter.flush();
|
||||
return beanChange(ChangeType.INSERT, request.beanId(), writer.toString(), null);
|
||||
} catch (IOException e) {
|
||||
log.log(Level.ERROR, "Failed to write ChangeLog entry for insert", e);
|
||||
log.log(ERROR, "Failed to write ChangeLog entry for insert", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -2288,11 +2289,11 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
private ElComparator<T> createPropertyComparator(SortByClause.Property sortProp) {
|
||||
ElPropertyValue elGetValue = elGetValue(sortProp.getName());
|
||||
if (elGetValue == null) {
|
||||
log.log(Level.ERROR, "Sort property [" + sortProp + "] not found in " + beanType + ". Cannot sort.");
|
||||
log.log(ERROR, "Sort property [" + sortProp + "] not found in " + beanType + ". Cannot sort.");
|
||||
return new ElComparatorNoop<>();
|
||||
}
|
||||
if (elGetValue.isAssocMany()) {
|
||||
log.log(Level.ERROR, "Sort property [" + sortProp + "] in " + beanType + " is a many-property. Cannot sort.");
|
||||
log.log(ERROR, "Sort property [" + sortProp + "] in " + beanType + " is a many-property. Cannot sort.");
|
||||
return new ElComparatorNoop<>();
|
||||
}
|
||||
Boolean nullsHigh = sortProp.getNullsHigh();
|
||||
@@ -2768,7 +2769,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
public void markAsDeleted(EntityBean bean) {
|
||||
if (softDeleteProperty == null) {
|
||||
Object id = getId(bean);
|
||||
log.log(Level.INFO, "(Lazy) loading unsuccessful for type:{0} id:{1} - expecting when bean has been deleted", name(), id);
|
||||
log.log(INFO, "(Lazy) loading unsuccessful for type:{0} id:{1} - expecting when bean has been deleted", name(), id);
|
||||
bean._ebean_getIntercept().setLazyLoadFailure(id);
|
||||
} else {
|
||||
softDeleteValue(bean);
|
||||
|
||||
+68
-67
@@ -16,9 +16,10 @@ import io.ebeaninternal.server.core.PersistRequestBean;
|
||||
import io.ebeaninternal.server.transaction.DefaultPersistenceContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.*;
|
||||
|
||||
import static java.lang.System.Logger.Level.*;
|
||||
|
||||
/**
|
||||
* Helper for BeanDescriptor that manages the bean, query and collection caches.
|
||||
*
|
||||
@@ -104,10 +105,10 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
void deriveNotifyFlags() {
|
||||
cacheNotifyOnAll = (invalidateQueryCache || beanCache != null || queryCache != null);
|
||||
cacheNotifyOnDelete = !cacheNotifyOnAll && isNotifyOnDeletes();
|
||||
if (log.isLoggable(Level.DEBUG)) {
|
||||
if (log.isLoggable(DEBUG)) {
|
||||
if (cacheNotifyOnAll || cacheNotifyOnDelete) {
|
||||
String notifyMode = cacheNotifyOnAll ? "All" : "Delete";
|
||||
log.log(Level.DEBUG, "l2 caching on {0} - beanCaching:{1} queryCaching:{2} notifyMode:{3} ",
|
||||
log.log(DEBUG, "l2 caching on {0} - beanCaching:{1} queryCaching:{2} notifyMode:{3} ",
|
||||
desc.fullName(), isBeanCaching(), isQueryCaching(), notifyMode);
|
||||
}
|
||||
}
|
||||
@@ -178,8 +179,8 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
*/
|
||||
void queryCacheClear() {
|
||||
if (queryCache != null) {
|
||||
if (queryLog.isLoggable(Level.DEBUG)) {
|
||||
queryLog.log(Level.DEBUG, " CLEAR {0}", cacheName);
|
||||
if (queryLog.isLoggable(DEBUG)) {
|
||||
queryLog.log(DEBUG, " CLEAR {0}", cacheName);
|
||||
}
|
||||
queryCache.clear();
|
||||
}
|
||||
@@ -202,11 +203,11 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
throw new IllegalStateException("No query cache enabled on " + desc + ". Need explicit @Cache(enableQueryCache=true)");
|
||||
}
|
||||
Object queryResult = queryCache.get(id);
|
||||
if (queryLog.isLoggable(Level.DEBUG)) {
|
||||
if (queryLog.isLoggable(DEBUG)) {
|
||||
if (queryResult == null) {
|
||||
queryLog.log(Level.DEBUG, " GET {0}({1}) - cache miss", cacheName, id);
|
||||
queryLog.log(DEBUG, " GET {0}({1}) - cache miss", cacheName, id);
|
||||
} else {
|
||||
queryLog.log(Level.DEBUG, " GET {0}({1}) - hit", cacheName, id);
|
||||
queryLog.log(DEBUG, " GET {0}({1}) - hit", cacheName, id);
|
||||
}
|
||||
}
|
||||
return queryResult;
|
||||
@@ -219,8 +220,8 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
if (queryCache == null) {
|
||||
throw new IllegalStateException("No query cache enabled on " + desc + ". Need explicit @Cache(enableQueryCache=true)");
|
||||
}
|
||||
if (queryLog.isLoggable(Level.DEBUG)) {
|
||||
queryLog.log(Level.DEBUG, " PUT {0}({1})", cacheName, id);
|
||||
if (queryLog.isLoggable(DEBUG)) {
|
||||
queryLog.log(DEBUG, " PUT {0}({1})", cacheName, id);
|
||||
}
|
||||
queryCache.put(id, entry);
|
||||
}
|
||||
@@ -228,16 +229,16 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
|
||||
void manyPropRemove(String propertyName, Object parentId) {
|
||||
ServerCache collectionIdsCache = cacheManager.getCollectionIdsCache(beanType, propertyName);
|
||||
if (manyLog.isLoggable(Level.TRACE)) {
|
||||
manyLog.log(Level.TRACE, " REMOVE {0}({1}).{2}", cacheName, parentId, propertyName);
|
||||
if (manyLog.isLoggable(TRACE)) {
|
||||
manyLog.log(TRACE, " REMOVE {0}({1}).{2}", cacheName, parentId, propertyName);
|
||||
}
|
||||
collectionIdsCache.remove(parentId);
|
||||
}
|
||||
|
||||
void manyPropClear(String propertyName) {
|
||||
ServerCache collectionIdsCache = cacheManager.getCollectionIdsCache(beanType, propertyName);
|
||||
if (manyLog.isLoggable(Level.DEBUG)) {
|
||||
manyLog.log(Level.DEBUG, " CLEAR {0}(*).{1} ", cacheName, propertyName);
|
||||
if (manyLog.isLoggable(DEBUG)) {
|
||||
manyLog.log(DEBUG, " CLEAR {0}(*).{1} ", cacheName, propertyName);
|
||||
}
|
||||
collectionIdsCache.clear();
|
||||
}
|
||||
@@ -249,11 +250,11 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
ServerCache collectionIdsCache = cacheManager.getCollectionIdsCache(beanType, propertyName);
|
||||
CachedManyIds entry = (CachedManyIds) collectionIdsCache.get(parentId);
|
||||
if (entry == null) {
|
||||
if (manyLog.isLoggable(Level.TRACE)) {
|
||||
manyLog.log(Level.TRACE, " GET {0}({1}).{2} - cache miss", cacheName, parentId, propertyName);
|
||||
if (manyLog.isLoggable(TRACE)) {
|
||||
manyLog.log(TRACE, " GET {0}({1}).{2} - cache miss", cacheName, parentId, propertyName);
|
||||
}
|
||||
} else if (manyLog.isLoggable(Level.DEBUG)) {
|
||||
manyLog.log(Level.DEBUG, " GET {0}({1}).{2} - hit", cacheName, parentId, propertyName);
|
||||
} else if (manyLog.isLoggable(DEBUG)) {
|
||||
manyLog.log(DEBUG, " GET {0}({1}).{2} - hit", cacheName, parentId, propertyName);
|
||||
}
|
||||
return entry;
|
||||
}
|
||||
@@ -303,12 +304,12 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
changes.put(many.name(), asJson);
|
||||
|
||||
CachedBeanData newData = data.update(changes, data.getVersion());
|
||||
if (beanLog.isLoggable(Level.DEBUG)) {
|
||||
beanLog.log(Level.DEBUG, " UPDATE {0}({1}) changes:{2}", cacheName, parentId, changes);
|
||||
if (beanLog.isLoggable(DEBUG)) {
|
||||
beanLog.log(DEBUG, " UPDATE {0}({1}) changes:{2}", cacheName, parentId, changes);
|
||||
}
|
||||
beanCache.put(parentId, newData);
|
||||
} catch (IOException e) {
|
||||
log.log(Level.ERROR, "Error updating L2 cache", e);
|
||||
log.log(ERROR, "Error updating L2 cache", e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -321,8 +322,8 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
|
||||
void cachePutManyIds(Object parentId, String manyName, CachedManyIds entry) {
|
||||
ServerCache collectionIdsCache = cacheManager.getCollectionIdsCache(beanType, manyName);
|
||||
if (manyLog.isLoggable(Level.DEBUG)) {
|
||||
manyLog.log(Level.DEBUG, " PUT {0}({1}).{2} - ids:{3}", cacheName, parentId, manyName, entry);
|
||||
if (manyLog.isLoggable(DEBUG)) {
|
||||
manyLog.log(DEBUG, " PUT {0}({1}).{2} - ids:{3}", cacheName, parentId, manyName, entry);
|
||||
}
|
||||
collectionIdsCache.put(parentId, entry);
|
||||
}
|
||||
@@ -353,8 +354,8 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
return new BeanCacheResult<>();
|
||||
}
|
||||
Map<Object, Object> beanDataMap = beanCache.getAll(keys);
|
||||
if (beanLog.isLoggable(Level.TRACE)) {
|
||||
beanLog.log(Level.TRACE, " MGET {0}({1}) - hits:{2}", cacheName, ids, beanDataMap.keySet());
|
||||
if (beanLog.isLoggable(TRACE)) {
|
||||
beanLog.log(TRACE, " MGET {0}({1}) - hits:{2}", cacheName, ids, beanDataMap.keySet());
|
||||
}
|
||||
BeanCacheResult<T> result = new BeanCacheResult<>();
|
||||
for (Map.Entry<Object, Object> entry : beanDataMap.entrySet()) {
|
||||
@@ -375,8 +376,8 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
|
||||
// naturalKey -> Id map
|
||||
Map<Object, Object> naturalKeyMap = naturalKeyCache.getAll(keys);
|
||||
if (natLog.isLoggable(Level.TRACE)) {
|
||||
natLog.log(Level.TRACE, " MLOOKUP {0}({1}) - hits:{2}", cacheName, keys, naturalKeyMap);
|
||||
if (natLog.isLoggable(TRACE)) {
|
||||
natLog.log(TRACE, " MLOOKUP {0}({1}) - hits:{2}", cacheName, keys, naturalKeyMap);
|
||||
}
|
||||
|
||||
BeanCacheResult<T> result = new BeanCacheResult<>();
|
||||
@@ -392,8 +393,8 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
|
||||
Set<Object> ids = new HashSet<>(naturalKeyMap.values());
|
||||
Map<Object, Object> beanDataMap = beanCache.getAll(ids);
|
||||
if (beanLog.isLoggable(Level.TRACE)) {
|
||||
beanLog.log(Level.TRACE, " MGET {0}({1}) - hits:{2}", cacheName, ids, beanDataMap.keySet());
|
||||
if (beanLog.isLoggable(TRACE)) {
|
||||
beanLog.log(TRACE, " MGET {0}({1}) - hits:{2}", cacheName, ids, beanDataMap.keySet());
|
||||
}
|
||||
// process the hits into beans etc
|
||||
for (Map.Entry<Object, Object> entry : beanDataMap.entrySet()) {
|
||||
@@ -437,8 +438,8 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
*/
|
||||
void beanCacheClear() {
|
||||
if (beanCache != null) {
|
||||
if (beanLog.isLoggable(Level.DEBUG)) {
|
||||
beanLog.log(Level.DEBUG, " CLEAR {0}", cacheName);
|
||||
if (beanLog.isLoggable(DEBUG)) {
|
||||
beanLog.log(DEBUG, " CLEAR {0}", cacheName);
|
||||
}
|
||||
beanCache.clear();
|
||||
}
|
||||
@@ -507,14 +508,14 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (beanLog.isLoggable(Level.DEBUG)) {
|
||||
beanLog.log(Level.DEBUG, " MPUT {0}({1})", cacheName, map.keySet());
|
||||
if (beanLog.isLoggable(DEBUG)) {
|
||||
beanLog.log(DEBUG, " MPUT {0}({1})", cacheName, map.keySet());
|
||||
}
|
||||
getBeanCache().putAll(map);
|
||||
|
||||
if (natKeys != null && !natKeys.isEmpty()) {
|
||||
if (natLog.isLoggable(Level.DEBUG)) {
|
||||
natLog.log(Level.DEBUG, " MPUT {0}({1}, {2})", cacheName, naturalKey, natKeys.keySet());
|
||||
if (natLog.isLoggable(DEBUG)) {
|
||||
natLog.log(DEBUG, " MPUT {0}({1}, {2})", cacheName, naturalKey, natKeys.keySet());
|
||||
}
|
||||
naturalKeyCache.putAll(natKeys);
|
||||
}
|
||||
@@ -526,15 +527,15 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
void beanCachePutDirect(EntityBean bean) {
|
||||
CachedBeanData beanData = beanExtractData(desc, bean);
|
||||
String key = desc.cacheKeyForBean(bean);
|
||||
if (beanLog.isLoggable(Level.DEBUG)) {
|
||||
beanLog.log(Level.DEBUG, " PUT {0}({1}) data:{2}", cacheName, key, beanData);
|
||||
if (beanLog.isLoggable(DEBUG)) {
|
||||
beanLog.log(DEBUG, " PUT {0}({1}) data:{2}", cacheName, key, beanData);
|
||||
}
|
||||
getBeanCache().put(key, beanData);
|
||||
if (naturalKey != null) {
|
||||
String naturalKey = calculateNaturalKey(beanData);
|
||||
if (naturalKey != null) {
|
||||
if (natLog.isLoggable(Level.DEBUG)) {
|
||||
natLog.log(Level.DEBUG, " PUT {0}({1}, {2})", cacheName, naturalKey, key);
|
||||
if (natLog.isLoggable(DEBUG)) {
|
||||
natLog.log(DEBUG, " PUT {0}({1}, {2})", cacheName, naturalKey, key);
|
||||
}
|
||||
naturalKeyCache.put(naturalKey, key);
|
||||
}
|
||||
@@ -575,13 +576,13 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
private T beanCacheGetInternal(String key, Boolean readOnly, PersistenceContext context) {
|
||||
CachedBeanData data = (CachedBeanData) getBeanCache().get(key);
|
||||
if (data == null) {
|
||||
if (beanLog.isLoggable(Level.TRACE)) {
|
||||
beanLog.log(Level.TRACE, " GET {0}({1}) - cache miss", cacheName, key);
|
||||
if (beanLog.isLoggable(TRACE)) {
|
||||
beanLog.log(TRACE, " GET {0}({1}) - cache miss", cacheName, key);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
if (beanLog.isLoggable(Level.TRACE)) {
|
||||
beanLog.log(Level.TRACE, " GET {0}({1}) - hit", cacheName, key);
|
||||
if (beanLog.isLoggable(TRACE)) {
|
||||
beanLog.log(TRACE, " GET {0}({1}) - hit", cacheName, key);
|
||||
}
|
||||
return convertToBean(key, readOnly, context, data);
|
||||
}
|
||||
@@ -591,8 +592,8 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
if (cacheSharableBeans && !Boolean.FALSE.equals(readOnly)) {
|
||||
Object bean = data.getSharableBean();
|
||||
if (bean != null) {
|
||||
if (beanLog.isLoggable(Level.TRACE)) {
|
||||
beanLog.log(Level.TRACE, " GET {0}({1}) - hit shared bean", cacheName, id);
|
||||
if (beanLog.isLoggable(TRACE)) {
|
||||
beanLog.log(TRACE, " GET {0}({1}) - hit shared bean", cacheName, id);
|
||||
}
|
||||
if (desc.isReadAuditing()) {
|
||||
desc.readAuditBean("l2", "", bean);
|
||||
@@ -680,8 +681,8 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
*/
|
||||
void beanCacheApplyInvalidate(Collection<String> keys) {
|
||||
if (beanCache != null) {
|
||||
if (beanLog.isLoggable(Level.DEBUG)) {
|
||||
beanLog.log(Level.DEBUG, " MREMOVE {0}({1})", cacheName, keys);
|
||||
if (beanLog.isLoggable(DEBUG)) {
|
||||
beanLog.log(DEBUG, " MREMOVE {0}({1})", cacheName, keys);
|
||||
}
|
||||
beanCache.removeAll(new HashSet<>(keys));
|
||||
}
|
||||
@@ -700,8 +701,8 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
}
|
||||
|
||||
Map<Object, Object> hits = getBeanCache().getAll(ebis.keySet());
|
||||
if (beanLog.isLoggable(Level.TRACE)) {
|
||||
beanLog.log(Level.TRACE, " MLOAD {0}({1}) - got hits ({2})", cacheName, ebis.keySet(), hits.size());
|
||||
if (beanLog.isLoggable(TRACE)) {
|
||||
beanLog.log(TRACE, " MLOAD {0}({1}) - got hits ({2})", cacheName, ebis.keySet(), hits.size());
|
||||
}
|
||||
|
||||
Set<EntityBeanIntercept> loaded = new HashSet<>();
|
||||
@@ -713,19 +714,19 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
CachedBeanData cacheData = (CachedBeanData) hit.getValue();
|
||||
|
||||
if (lazyLoadProperty > -1 && !cacheData.isLoaded(propertyName)) {
|
||||
if (beanLog.isLoggable(Level.TRACE)) {
|
||||
beanLog.log(Level.TRACE, " load {0}({1}) - cache miss on property({2})", cacheName, key, propertyName);
|
||||
if (beanLog.isLoggable(TRACE)) {
|
||||
beanLog.log(TRACE, " load {0}({1}) - cache miss on property({2})", cacheName, key, propertyName);
|
||||
}
|
||||
} else {
|
||||
CachedBeanDataToBean.load(desc, ebi.getOwner(), cacheData, context);
|
||||
loaded.add(ebi);
|
||||
if (beanLog.isLoggable(Level.DEBUG)) {
|
||||
beanLog.log(Level.DEBUG, " load {0}({1}) - hit", cacheName, key);
|
||||
if (beanLog.isLoggable(DEBUG)) {
|
||||
beanLog.log(DEBUG, " load {0}({1}) - hit", cacheName, key);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!ebis.isEmpty() && beanLog.isLoggable(Level.TRACE)) {
|
||||
beanLog.log(Level.TRACE, " load {0}({1}) - cache miss", cacheName, ebis.keySet());
|
||||
if (!ebis.isEmpty() && beanLog.isLoggable(TRACE)) {
|
||||
beanLog.log(TRACE, " load {0}({1}) - cache miss", cacheName, ebis.keySet());
|
||||
}
|
||||
return loaded;
|
||||
}
|
||||
@@ -736,21 +737,21 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
boolean beanCacheLoad(EntityBean bean, EntityBeanIntercept ebi, String key, PersistenceContext context) {
|
||||
CachedBeanData cacheData = (CachedBeanData) getBeanCache().get(key);
|
||||
if (cacheData == null) {
|
||||
if (beanLog.isLoggable(Level.TRACE)) {
|
||||
beanLog.log(Level.TRACE, " LOAD {0}({1}) - cache miss", cacheName, key);
|
||||
if (beanLog.isLoggable(TRACE)) {
|
||||
beanLog.log(TRACE, " LOAD {0}({1}) - cache miss", cacheName, key);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
int lazyLoadProperty = ebi.getLazyLoadPropertyIndex();
|
||||
if (lazyLoadProperty > -1 && !cacheData.isLoaded(ebi.getLazyLoadProperty())) {
|
||||
if (beanLog.isLoggable(Level.TRACE)) {
|
||||
beanLog.log(Level.TRACE, " LOAD {0}({1}) - cache miss on property({2})", cacheName, key, ebi.getLazyLoadProperty());
|
||||
if (beanLog.isLoggable(TRACE)) {
|
||||
beanLog.log(TRACE, " LOAD {0}({1}) - cache miss on property({2})", cacheName, key, ebi.getLazyLoadProperty());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
CachedBeanDataToBean.load(desc, bean, cacheData, context);
|
||||
if (beanLog.isLoggable(Level.DEBUG)) {
|
||||
beanLog.log(Level.DEBUG, " LOAD {0}({1}) - hit", cacheName, key);
|
||||
if (beanLog.isLoggable(DEBUG)) {
|
||||
beanLog.log(DEBUG, " LOAD {0}({1}) - hit", cacheName, key);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -874,8 +875,8 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
if (existingData != null) {
|
||||
long currentVersion = existingData.getVersion();
|
||||
if (version > 0 && version < currentVersion) {
|
||||
if (beanLog.isLoggable(Level.DEBUG)) {
|
||||
beanLog.log(Level.DEBUG, " REMOVE {0}({1}) - version conflict old:{2} new:{3}", cacheName, key, currentVersion, version);
|
||||
if (beanLog.isLoggable(DEBUG)) {
|
||||
beanLog.log(DEBUG, " REMOVE {0}({1}) - version conflict old:{2} new:{3}", cacheName, key, currentVersion, version);
|
||||
}
|
||||
cache.remove(key);
|
||||
} else {
|
||||
@@ -883,16 +884,16 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
version = currentVersion;
|
||||
}
|
||||
CachedBeanData newData = existingData.update(changes, version);
|
||||
if (beanLog.isLoggable(Level.DEBUG)) {
|
||||
beanLog.log(Level.DEBUG, " UPDATE {0}({1}) changes:{2}", cacheName, key, changes);
|
||||
if (beanLog.isLoggable(DEBUG)) {
|
||||
beanLog.log(DEBUG, " UPDATE {0}({1}) changes:{2}", cacheName, key, changes);
|
||||
}
|
||||
cache.put(key, newData);
|
||||
}
|
||||
if (updateNaturalKey) {
|
||||
Object oldKey = calculateNaturalKey(existingData);
|
||||
if (oldKey != null) {
|
||||
if (natLog.isLoggable(Level.DEBUG)) {
|
||||
natLog.log(Level.DEBUG, ".. update {0} REMOVE({1}) - old key for ({2})", cacheName, oldKey, key);
|
||||
if (natLog.isLoggable(DEBUG)) {
|
||||
natLog.log(DEBUG, ".. update {0} REMOVE({1}) - old key for ({2})", cacheName, oldKey, key);
|
||||
}
|
||||
naturalKeyCache.remove(oldKey);
|
||||
}
|
||||
|
||||
+11
-10
@@ -47,12 +47,13 @@ import javax.persistence.PersistenceException;
|
||||
import javax.persistence.Transient;
|
||||
import javax.sql.DataSource;
|
||||
import java.io.Serializable;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static java.lang.System.Logger.Level.*;
|
||||
|
||||
/**
|
||||
* Creates BeanDescriptors.
|
||||
*/
|
||||
@@ -309,7 +310,7 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
|
||||
} catch (BeanNotEnhancedException e) {
|
||||
throw e;
|
||||
} catch (RuntimeException e) {
|
||||
log.log(Level.ERROR, "Error in deployment", e);
|
||||
log.log(ERROR, "Error in deployment", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
@@ -332,13 +333,13 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
|
||||
try {
|
||||
entityClass = Class.forName(entityClassName, false, classLoader);
|
||||
} catch (Exception e) {
|
||||
log.log(Level.ERROR, "Could not load entity bean class " + entityClassName + " for ebean.xml entry");
|
||||
log.log(ERROR, "Could not load entity bean class " + entityClassName + " for ebean.xml entry");
|
||||
return;
|
||||
}
|
||||
|
||||
DeployBeanInfo<?> info = deployInfoMap.get(entityClass);
|
||||
if (info == null) {
|
||||
log.log(Level.ERROR, "No entity bean for ebean.xml entry " + entityClassName);
|
||||
log.log(ERROR, "No entity bean for ebean.xml entry " + entityClassName);
|
||||
|
||||
} else {
|
||||
for (XmapRawSql sql : entityDeploy.getRawSql()) {
|
||||
@@ -601,11 +602,11 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
|
||||
int pc = postConstructManager.getRegisterCount();
|
||||
int lc = persistListenerManager.getRegisterCount();
|
||||
int fc = beanFinderManager.getRegisterCount();
|
||||
log.log(Level.DEBUG, "BeanPersistControllers[{0}] BeanFinders[{1}] BeanPersistListeners[{2}] BeanQueryAdapters[{3}] BeanPostLoaders[{4}] BeanPostConstructors[{5}]", cc, fc, lc, qa, pl, pc);
|
||||
log.log(DEBUG, "BeanPersistControllers[{0}] BeanFinders[{1}] BeanPersistListeners[{2}] BeanQueryAdapters[{3}] BeanPostLoaders[{4}] BeanPostConstructors[{5}]", cc, fc, lc, qa, pl, pc);
|
||||
}
|
||||
|
||||
private void logStatus() {
|
||||
log.log(Level.DEBUG, "Entities[{0}]", entityBeanCount);
|
||||
log.log(DEBUG, "Entities[{0}]", entityBeanCount);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -867,10 +868,10 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
|
||||
if (possibleLower.contains(searchName)) {
|
||||
// we have a match
|
||||
prop.setMappedBy(possibleMappedBy);
|
||||
if (log.isLoggable(Level.DEBUG)) {
|
||||
if (log.isLoggable(DEBUG)) {
|
||||
String m = "Implicitly found mappedBy for " + targetDesc + "." + prop;
|
||||
m += " by searching for [" + searchName + "] against " + matchSet;
|
||||
log.log(Level.DEBUG, m);
|
||||
log.log(DEBUG, m);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -1207,12 +1208,12 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
|
||||
final DeployIdentityMode identityMode = desc.getIdentityMode();
|
||||
if (identityMode.isSequence() && !dbIdentity.isSupportsSequence()) {
|
||||
// explicit sequence but not supported by the DatabasePlatform
|
||||
log.log(Level.INFO, "Explicit sequence on {0} but not supported by DB Platform - ignored", desc.getFullName());
|
||||
log.log(INFO, "Explicit sequence on {0} but not supported by DB Platform - ignored", desc.getFullName());
|
||||
identityMode.setIdType(IdType.AUTO);
|
||||
}
|
||||
if (identityMode.isIdentity() && !dbIdentity.isSupportsIdentity()) {
|
||||
// explicit identity but not supported by the DatabasePlatform
|
||||
log.log(Level.INFO, "Explicit Identity on {0} but not supported by DB Platform - ignored", desc.getFullName());
|
||||
log.log(INFO, "Explicit Identity on {0} but not supported by DB Platform - ignored", desc.getFullName());
|
||||
identityMode.setIdType(IdType.AUTO);
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,6 @@ import javax.persistence.PersistenceException;
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.lang.reflect.Field;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Types;
|
||||
@@ -52,6 +51,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import static java.lang.System.Logger.Level.ERROR;
|
||||
|
||||
/**
|
||||
* Description of a property of a bean. Includes its deployment information such
|
||||
* as database column mapping information.
|
||||
@@ -1434,7 +1435,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
|
||||
objValue = null;
|
||||
String msg = "Error trying to use Jackson ObjectMapper to read transient property "
|
||||
+ fullName() + " - consider marking this property with @JsonIgnore";
|
||||
CoreLog.log.log(Level.ERROR, msg, e);
|
||||
CoreLog.log.log(ERROR, msg, e);
|
||||
}
|
||||
}
|
||||
if (jsonDeserialize) {
|
||||
|
||||
@@ -27,10 +27,11 @@ import io.ebeanservice.docstore.api.mapping.DocPropertyMapping;
|
||||
import io.ebeanservice.docstore.api.support.DocStructure;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static java.lang.System.Logger.Level.ERROR;
|
||||
|
||||
/**
|
||||
* Abstract base for properties mapped to an associated bean, list, set or map.
|
||||
*/
|
||||
@@ -433,7 +434,7 @@ public abstract class BeanPropertyAssoc<T> extends BeanProperty implements STree
|
||||
if (!idProp.isEmbedded()) {
|
||||
// simple single scalar id
|
||||
if (cols.length != 1) {
|
||||
CoreLog.log.log(Level.ERROR, "No Imported Id column for [" + idProp + "] in table [" + join.getTable() + "]");
|
||||
CoreLog.log.log(ERROR, "No Imported Id column for [" + idProp + "] in table [" + join.getTable() + "]");
|
||||
return null;
|
||||
} else {
|
||||
BeanProperty[] idProps = {idProp};
|
||||
|
||||
@@ -24,9 +24,10 @@ import io.ebeaninternal.server.query.SqlBeanLoad;
|
||||
import javax.persistence.PersistenceException;
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.*;
|
||||
|
||||
import static java.lang.System.Logger.Level.ERROR;
|
||||
|
||||
/**
|
||||
* Property mapped to a List Set or Map.
|
||||
*/
|
||||
@@ -668,7 +669,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
|
||||
}
|
||||
} catch (PersistenceException e) {
|
||||
// not found as individual scalar properties
|
||||
CoreLog.log.log(Level.ERROR, "Could not find a exported property?", e);
|
||||
CoreLog.log.log(ERROR, "Could not find a exported property?", e);
|
||||
}
|
||||
} else {
|
||||
if (idProp != null) {
|
||||
@@ -963,7 +964,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
|
||||
setValue(bean, collection);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
CoreLog.log.log(Level.ERROR, "Error setting value from L2 cache", e);
|
||||
CoreLog.log.log(ERROR, "Error setting value from L2 cache", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -976,7 +977,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
|
||||
}
|
||||
return jsonWriteCollection(collection);
|
||||
} catch (Exception e) {
|
||||
CoreLog.log.log(Level.ERROR, "Error building value element collection json for L2 cache", e);
|
||||
CoreLog.log.log(ERROR, "Error building value element collection json for L2 cache", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import io.ebeaninternal.server.deploy.meta.DeployBeanTable;
|
||||
import io.ebeaninternal.server.deploy.meta.DeployTableJoin;
|
||||
import io.ebeaninternal.server.deploy.meta.DeployTableJoinColumn;
|
||||
|
||||
import java.lang.System.Logger.Level;
|
||||
import static java.lang.System.Logger.Level.DEBUG;
|
||||
|
||||
|
||||
/**
|
||||
@@ -107,7 +107,7 @@ public final class BeanTable {
|
||||
if (complexKey) {
|
||||
// just to copy the column name rather than prefix with the foreignKeyPrefix.
|
||||
// I think that with complex keys this is the more common approach.
|
||||
CoreLog.internal.log(Level.DEBUG, "On table[{0}] foreign key column [{1}]", baseTable, lc);
|
||||
CoreLog.internal.log(DEBUG, "On table[{0}] foreign key column [{1}]", baseTable, lc);
|
||||
fk = lc;
|
||||
}
|
||||
if (sqlFormulaSelect != null) {
|
||||
|
||||
+4
-3
@@ -15,7 +15,8 @@ import io.ebeaninternal.server.deploy.meta.DeployTableJoinColumn;
|
||||
import io.ebeaninternal.server.query.SqlJoinType;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.lang.System.Logger.Level;
|
||||
|
||||
import static java.lang.System.Logger.Level.INFO;
|
||||
|
||||
/**
|
||||
* Read the deployment annotations for Associated One beans.
|
||||
@@ -214,10 +215,10 @@ final class AnnotationAssocOnes extends AnnotationAssoc {
|
||||
prop.setPrimaryKeyJoin(true);
|
||||
|
||||
if (!primaryKeyJoin.name().isEmpty()) {
|
||||
CoreLog.internal.log(Level.INFO, "Automatically determining join columns for @PrimaryKeyJoinColumn - ignoring PrimaryKeyJoinColumn.name attribute [{0}] on {1}", primaryKeyJoin.name(), prop.getFullBeanName());
|
||||
CoreLog.internal.log(INFO, "Automatically determining join columns for @PrimaryKeyJoinColumn - ignoring PrimaryKeyJoinColumn.name attribute [{0}] on {1}", primaryKeyJoin.name(), prop.getFullBeanName());
|
||||
}
|
||||
if (!primaryKeyJoin.referencedColumnName().isEmpty()) {
|
||||
CoreLog.internal.log(Level.INFO, "Automatically determining join columns for @PrimaryKeyJoinColumn - Ignoring PrimaryKeyJoinColumn.referencedColumnName attribute [{0}] on {1}", primaryKeyJoin.referencedColumnName(), prop.getFullBeanName());
|
||||
CoreLog.internal.log(INFO, "Automatically determining join columns for @PrimaryKeyJoinColumn - Ignoring PrimaryKeyJoinColumn.referencedColumnName attribute [{0}] on {1}", primaryKeyJoin.referencedColumnName(), prop.getFullBeanName());
|
||||
}
|
||||
BeanTable baseBeanTable = factory.beanTable(info.getDescriptor().getBeanType());
|
||||
String localPrimaryKey = baseBeanTable.getIdColumn();
|
||||
|
||||
@@ -1,19 +1,7 @@
|
||||
package io.ebeaninternal.server.deploy.parse;
|
||||
|
||||
import io.ebean.annotation.Cache;
|
||||
import io.ebean.annotation.DbComment;
|
||||
import io.ebean.annotation.DbPartition;
|
||||
import io.ebean.annotation.DocStore;
|
||||
import io.ebean.annotation.Draftable;
|
||||
import io.ebean.annotation.DraftableElement;
|
||||
import io.ebean.annotation.History;
|
||||
import io.ebean.annotation.Identity;
|
||||
import io.ebean.annotation.Index;
|
||||
import io.ebean.annotation.InvalidateQueryCache;
|
||||
import io.ebean.annotation.ReadAudit;
|
||||
import io.ebean.annotation.StorageEngine;
|
||||
import io.ebean.annotation.Tablespace;
|
||||
import io.ebean.annotation.View;
|
||||
import io.ebean.annotation.*;
|
||||
import io.ebean.config.TableName;
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import io.ebeaninternal.server.deploy.BeanDescriptor.EntityType;
|
||||
@@ -23,18 +11,10 @@ import io.ebeaninternal.server.deploy.PartitionMeta;
|
||||
import io.ebeaninternal.server.deploy.TablespaceMeta;
|
||||
import io.ebeaninternal.server.deploy.meta.DeployBeanProperty;
|
||||
|
||||
import javax.persistence.AttributeOverride;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Embeddable;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.IdClass;
|
||||
import javax.persistence.NamedQuery;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.UniqueConstraint;
|
||||
|
||||
import java.lang.System.Logger.Level;
|
||||
import javax.persistence.*;
|
||||
|
||||
import static io.ebean.util.AnnotationUtil.typeGet;
|
||||
import static java.lang.System.Logger.Level.ERROR;
|
||||
|
||||
/**
|
||||
* Read the class level deployment annotations.
|
||||
@@ -67,7 +47,7 @@ final class AnnotationClass extends AnnotationParser {
|
||||
Column column = override.column();
|
||||
DeployBeanProperty beanProperty = descriptor.getBeanProperty(propertyName);
|
||||
if (beanProperty == null) {
|
||||
CoreLog.log.log(Level.ERROR, "AttributeOverride property [" + propertyName + "] not found on " + descriptor.getFullName());
|
||||
CoreLog.log.log(ERROR, "AttributeOverride property [" + propertyName + "] not found on " + descriptor.getFullName());
|
||||
} else {
|
||||
readColumn(column, beanProperty);
|
||||
}
|
||||
|
||||
+6
-5
@@ -11,9 +11,10 @@ import io.ebeaninternal.server.type.TypeManager;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
import javax.persistence.Transient;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.lang.reflect.*;
|
||||
|
||||
import static java.lang.System.Logger.Level.*;
|
||||
|
||||
/**
|
||||
* Create the properties for a bean.
|
||||
* <p>
|
||||
@@ -85,7 +86,7 @@ public final class DeployCreateProperties {
|
||||
if (replaced != null && !replaced.isTransient()) {
|
||||
String msg = "Huh??? property " + prop.getFullBeanName() + " being defined twice";
|
||||
msg += " but replaced property was not transient? This is not expected?";
|
||||
CoreLog.log.log(Level.WARNING, msg);
|
||||
CoreLog.log.log(WARNING, msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -112,7 +113,7 @@ public final class DeployCreateProperties {
|
||||
return new DeployBeanPropertySimpleCollection(desc, targetType, manyType);
|
||||
}
|
||||
} catch (NullPointerException e) {
|
||||
CoreLog.internal.log(Level.DEBUG, "expected non-scalar type {0}", e.getMessage());
|
||||
CoreLog.internal.log(DEBUG, "expected non-scalar type {0}", e.getMessage());
|
||||
}
|
||||
return new DeployBeanPropertyAssocMany(desc, targetType, manyType);
|
||||
}
|
||||
@@ -133,7 +134,7 @@ public final class DeployCreateProperties {
|
||||
// not supporting this field (generic type used)
|
||||
return null;
|
||||
}
|
||||
CoreLog.internal.log(Level.WARNING, "Could not find parameter type (via reflection) on " + desc.getFullName() + " " + field.getName());
|
||||
CoreLog.internal.log(WARNING, "Could not find parameter type (via reflection) on " + desc.getFullName() + " " + field.getName());
|
||||
}
|
||||
return createManyType(desc, targetType, manyType);
|
||||
}
|
||||
@@ -152,7 +153,7 @@ public final class DeployCreateProperties {
|
||||
return new DeployBeanPropertyAssocOne(desc, propertyType);
|
||||
|
||||
} catch (Exception e) {
|
||||
CoreLog.log.log(Level.ERROR, "Error with " + desc + " field:" + field.getName(), e);
|
||||
CoreLog.log.log(ERROR, "Error with " + desc + " field:" + field.getName(), e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,13 +3,14 @@ package io.ebeaninternal.server.dto;
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import io.ebeaninternal.server.type.TypeManager;
|
||||
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static java.lang.System.Logger.Level.DEBUG;
|
||||
|
||||
/**
|
||||
* Build the DtoMeta for a bean.
|
||||
* <p>
|
||||
@@ -40,7 +41,7 @@ final class DtoMetaBuilder {
|
||||
final String name = propertyName(method.getName());
|
||||
properties.add(new DtoMetaProperty(typeManager, dtoType, method, name));
|
||||
} catch (Exception e) {
|
||||
CoreLog.log.log(Level.DEBUG, "exclude on " + dtoType + " method " + method, e);
|
||||
CoreLog.log.log(DEBUG, "exclude on " + dtoType + " method " + method, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -78,7 +79,7 @@ final class DtoMetaBuilder {
|
||||
constructorList.add(new DtoMetaConstructor(typeManager, constructor, dtoType));
|
||||
} catch (Exception e) {
|
||||
// we don't want that constructor
|
||||
CoreLog.log.log(Level.DEBUG, "exclude on " + dtoType + " constructor " + constructor, e);
|
||||
CoreLog.log.log(DEBUG, "exclude on " + dtoType + " constructor " + constructor, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+6
-5
@@ -2,10 +2,11 @@ package io.ebeaninternal.server.executor;
|
||||
|
||||
import io.avaje.applog.AppLog;
|
||||
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.concurrent.*;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import static java.lang.System.Logger.Level.*;
|
||||
|
||||
/**
|
||||
* A "CachedThreadPool" based on Daemon threads.
|
||||
* <p>
|
||||
@@ -43,19 +44,19 @@ final class DaemonExecutorService {
|
||||
lock.lock();
|
||||
try {
|
||||
if (service.isShutdown()) {
|
||||
logger.log(Level.DEBUG, "DaemonExecutorService[{0}] already shut down", namePrefix);
|
||||
logger.log(DEBUG, "DaemonExecutorService[{0}] already shut down", namePrefix);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
logger.log(Level.DEBUG, "DaemonExecutorService[{0}] shutting down...", namePrefix);
|
||||
logger.log(DEBUG, "DaemonExecutorService[{0}] shutting down...", namePrefix);
|
||||
service.shutdown();
|
||||
if (!service.awaitTermination(shutdownWaitSeconds, TimeUnit.SECONDS)) {
|
||||
logger.log(Level.INFO, "DaemonExecutorService[{0}] shut down timeout exceeded. Terminating running threads.", namePrefix);
|
||||
logger.log(INFO, "DaemonExecutorService[{0}] shut down timeout exceeded. Terminating running threads.", namePrefix);
|
||||
service.shutdownNow();
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.log(Level.ERROR, "Error during shutdown of DaemonThreadPool[" + namePrefix + "]", e);
|
||||
logger.log(ERROR, "Error during shutdown of DaemonThreadPool[" + namePrefix + "]", e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
} finally {
|
||||
|
||||
+7
-6
@@ -2,11 +2,12 @@ package io.ebeaninternal.server.executor;
|
||||
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import static java.lang.System.Logger.Level.*;
|
||||
|
||||
/**
|
||||
* Daemon based ScheduleThreadPool.
|
||||
*/
|
||||
@@ -38,19 +39,19 @@ public final class DaemonScheduleThreadPool extends ScheduledThreadPoolExecutor
|
||||
lock.lock();
|
||||
try {
|
||||
if (super.isShutdown()) {
|
||||
log.log(Level.DEBUG, "Already shutdown threadPool {0}", namePrefix);
|
||||
log.log(DEBUG, "Already shutdown threadPool {0}", namePrefix);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
log.log(Level.TRACE, "shutting down threadPool {0}", namePrefix);
|
||||
log.log(TRACE, "shutting down threadPool {0}", namePrefix);
|
||||
super.shutdown();
|
||||
if (!super.awaitTermination(shutdownWaitSeconds, TimeUnit.SECONDS)) {
|
||||
log.log(Level.INFO, "Shutdown wait timeout exceeded. Terminating running threads for {0}", namePrefix);
|
||||
log.log(INFO, "Shutdown wait timeout exceeded. Terminating running threads for {0}", namePrefix);
|
||||
super.shutdownNow();
|
||||
}
|
||||
log.log(Level.TRACE, "shutdown complete for threadPool {0}", namePrefix);
|
||||
log.log(TRACE, "shutdown complete for threadPool {0}", namePrefix);
|
||||
} catch (Exception e) {
|
||||
log.log(Level.ERROR, "Error during shutdown of threadPool " + namePrefix, e);
|
||||
log.log(ERROR, "Error during shutdown of threadPool " + namePrefix, e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
} finally {
|
||||
|
||||
+10
-9
@@ -5,9 +5,10 @@ import io.avaje.lang.NonNullApi;
|
||||
import io.ebean.config.BackgroundExecutorWrapper;
|
||||
import io.ebeaninternal.api.SpiBackgroundExecutor;
|
||||
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.concurrent.*;
|
||||
|
||||
import static java.lang.System.Logger.Level.*;
|
||||
|
||||
/**
|
||||
* The default implementation of the BackgroundExecutor.
|
||||
*/
|
||||
@@ -27,7 +28,7 @@ public final class DefaultBackgroundExecutor implements SpiBackgroundExecutor {
|
||||
this.schedulePool = new DaemonScheduleThreadPool(schedulePoolSize, shutdownWaitSeconds, namePrefix + "-periodic-");
|
||||
this.pool = new DaemonExecutorService(shutdownWaitSeconds, namePrefix);
|
||||
this.wrapper = wrapper;
|
||||
log.log(Level.DEBUG, "Created backgroundExecutor {0} (schedulePoolSize={1}, shutdownWaitSeconds={2})", namePrefix, schedulePoolSize, shutdownWaitSeconds);
|
||||
log.log(DEBUG, "Created backgroundExecutor {0} (schedulePoolSize={1}, shutdownWaitSeconds={2})", namePrefix, schedulePoolSize, shutdownWaitSeconds);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -64,14 +65,14 @@ public final class DefaultBackgroundExecutor implements SpiBackgroundExecutor {
|
||||
*/
|
||||
private Runnable logExceptions(Runnable task) {
|
||||
long queued = System.nanoTime();
|
||||
log.log(Level.TRACE, "Queued {0}", task);
|
||||
log.log(TRACE, "Queued {0}", task);
|
||||
return () -> {
|
||||
try {
|
||||
if (log.isLoggable(Level.TRACE)) {
|
||||
if (log.isLoggable(TRACE)) {
|
||||
long start = System.nanoTime();
|
||||
log.log(Level.TRACE, "Start {0} (delay time {1} us)", task, (start - queued) / 1000L);
|
||||
log.log(TRACE, "Start {0} (delay time {1} us)", task, (start - queued) / 1000L);
|
||||
task.run();
|
||||
log.log(Level.TRACE, "Stop {0} (exec time {1} us)", task, (System.nanoTime() - start) / 1000L);
|
||||
log.log(TRACE, "Stop {0} (exec time {1} us)", task, (System.nanoTime() - start) / 1000L);
|
||||
} else {
|
||||
task.run();
|
||||
}
|
||||
@@ -79,7 +80,7 @@ public final class DefaultBackgroundExecutor implements SpiBackgroundExecutor {
|
||||
// log any exception here. Note they will not bubble up to the calling user
|
||||
// unless Future.get() is checked. (Which is almost never done on scheduled
|
||||
// background executions)
|
||||
log.log(Level.ERROR, "Error while executing the task " + task, t);
|
||||
log.log(ERROR, "Error while executing the task " + task, t);
|
||||
throw t;
|
||||
}
|
||||
};
|
||||
@@ -127,10 +128,10 @@ public final class DefaultBackgroundExecutor implements SpiBackgroundExecutor {
|
||||
|
||||
@Override
|
||||
public void shutdown() {
|
||||
log.log(Level.TRACE, "BackgroundExecutor shutting down");
|
||||
log.log(TRACE, "BackgroundExecutor shutting down");
|
||||
schedulePool.shutdown();
|
||||
pool.shutdown();
|
||||
log.log(Level.DEBUG, "BackgroundExecutor stopped");
|
||||
log.log(DEBUG, "BackgroundExecutor stopped");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,12 +1,13 @@
|
||||
package io.ebeaninternal.server.idgen;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.net.NetworkInterface;
|
||||
import java.net.SocketException;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import static java.lang.System.Logger.Level.*;
|
||||
|
||||
/**
|
||||
* IdGenerator for java util UUID.
|
||||
* <p>
|
||||
@@ -82,7 +83,7 @@ public class UuidV1IdGenerator extends UuidV1RndIdGenerator {
|
||||
}
|
||||
}
|
||||
} catch (SocketException ex) {
|
||||
log.log(Level.DEBUG, "Skipping " + network, ex);
|
||||
log.log(DEBUG, "Skipping " + network, ex);
|
||||
}
|
||||
}
|
||||
return fallbackAddr;
|
||||
@@ -119,7 +120,7 @@ public class UuidV1IdGenerator extends UuidV1RndIdGenerator {
|
||||
// See, if there is an alternative MAC address set.
|
||||
nodeId = parseAlternativeNodeId(altNodeId);
|
||||
restoreState();
|
||||
log.log(Level.INFO, "Explicitly using ID {0} to generate Type 1 UUIDs", getNodeIdentifier());
|
||||
log.log(INFO, "Explicitly using ID {0} to generate Type 1 UUIDs", getNodeIdentifier());
|
||||
}
|
||||
UUID uuid = nextId(null);
|
||||
long ts = timeStamp.get();
|
||||
@@ -127,9 +128,9 @@ public class UuidV1IdGenerator extends UuidV1RndIdGenerator {
|
||||
ts /= MILLIS_TO_UUID;
|
||||
|
||||
saveState();
|
||||
log.log(Level.DEBUG, "Saved state: clockSeq {0}, timestamp {1}, uuid {2}, stateFile: {3})", clockSeq.get(), new Date(ts), uuid, stateFile);
|
||||
log.log(DEBUG, "Saved state: clockSeq {0}, timestamp {1}, uuid {2}, stateFile: {3})", clockSeq.get(), new Date(ts), uuid, stateFile);
|
||||
} catch (IOException e) {
|
||||
log.log(Level.ERROR, "There was a problem while detecting the nodeId. Falling back to random mode. Try using to specify 'ebean.uuidNodeId' property", e);
|
||||
log.log(ERROR, "There was a problem while detecting the nodeId. Falling back to random mode. Try using to specify 'ebean.uuidNodeId' property", e);
|
||||
useRandomMode();
|
||||
}
|
||||
}
|
||||
@@ -146,16 +147,16 @@ public class UuidV1IdGenerator extends UuidV1RndIdGenerator {
|
||||
try {
|
||||
nodeId = getHardwareId();
|
||||
} catch (IOException e) {
|
||||
log.log(Level.ERROR, "Error while reading MAC address. Fall back to 'generate' mode", e);
|
||||
log.log(ERROR, "Error while reading MAC address. Fall back to 'generate' mode", e);
|
||||
tryGenerateMode();
|
||||
}
|
||||
|
||||
if (nodeId != null) {
|
||||
restoreState();
|
||||
log.log(Level.INFO, "Using MAC {0} to generate Type 1 UUIDs", getNodeIdentifier());
|
||||
log.log(INFO, "Using MAC {0} to generate Type 1 UUIDs", getNodeIdentifier());
|
||||
return;
|
||||
}
|
||||
log.log(Level.WARNING, "No suitable network interface found. Fall back to 'generate' mode");
|
||||
log.log(WARNING, "No suitable network interface found. Fall back to 'generate' mode");
|
||||
tryGenerateMode();
|
||||
}
|
||||
|
||||
@@ -165,11 +166,11 @@ public class UuidV1IdGenerator extends UuidV1RndIdGenerator {
|
||||
*/
|
||||
private void tryGenerateMode() throws IOException {
|
||||
if (restoreState()) {
|
||||
log.log(Level.INFO, "Using recently generated nodeId {0} to generate Type 1 UUIDs", getNodeIdentifier());
|
||||
log.log(INFO, "Using recently generated nodeId {0} to generate Type 1 UUIDs", getNodeIdentifier());
|
||||
} else {
|
||||
// RFC 4.5 use random portion for node
|
||||
nodeId = super.getNodeIdBytes();
|
||||
log.log(Level.INFO, "Using a newly generated nodeId {0} to generate Type 1 UUIDs", getNodeIdentifier());
|
||||
log.log(INFO, "Using a newly generated nodeId {0} to generate Type 1 UUIDs", getNodeIdentifier());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,7 +181,7 @@ public class UuidV1IdGenerator extends UuidV1RndIdGenerator {
|
||||
private void useRandomMode() {
|
||||
canSaveState = false;
|
||||
nodeId = super.getNodeIdBytes();
|
||||
log.log(Level.INFO, "Explicitly using a new random ID {0} to generate Type 1 UUIDs", getNodeIdentifier());
|
||||
log.log(INFO, "Explicitly using a new random ID {0} to generate Type 1 UUIDs", getNodeIdentifier());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -211,14 +212,14 @@ public class UuidV1IdGenerator extends UuidV1RndIdGenerator {
|
||||
|
||||
String propNodeId = prop.getProperty("nodeId");
|
||||
if (propNodeId == null || propNodeId.isEmpty()) {
|
||||
log.log(Level.WARNING, "State file '{0}' is incomplete", stateFile);
|
||||
log.log(WARNING, "State file '{0}' is incomplete", stateFile);
|
||||
return false; // we cannot restore
|
||||
}
|
||||
try {
|
||||
if (nodeId == null) {
|
||||
nodeId = parseAlternativeNodeId(propNodeId);
|
||||
} else if (!getNodeIdentifier().equals(propNodeId)) {
|
||||
log.log(Level.WARNING,
|
||||
log.log(WARNING,
|
||||
"The nodeId in the state file '{0}' has changed from {1} to {2}. "
|
||||
+ "This can happen when MAC address changes or when two containers share the same state file",
|
||||
stateFile, propNodeId, getNodeIdentifier());
|
||||
@@ -231,7 +232,7 @@ public class UuidV1IdGenerator extends UuidV1RndIdGenerator {
|
||||
return true;
|
||||
|
||||
} catch (IllegalArgumentException nfe) {
|
||||
log.log(Level.ERROR, "State file corrupt: " + stateFile, nfe);
|
||||
log.log(ERROR, "State file corrupt: " + stateFile, nfe);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -255,7 +256,7 @@ public class UuidV1IdGenerator extends UuidV1RndIdGenerator {
|
||||
try (OutputStream os = new FileOutputStream(stateFile)) {
|
||||
prop.store(os, "ebean uuid state file");
|
||||
} catch (IOException e) {
|
||||
log.log(Level.ERROR, "Could not persist uuid state to: " + stateFile, e);
|
||||
log.log(ERROR, "Could not persist uuid state to: " + stateFile, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,13 +4,14 @@ import io.avaje.applog.AppLog;
|
||||
import io.ebean.Transaction;
|
||||
import io.ebean.config.dbplatform.PlatformIdGenerator;
|
||||
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import static java.lang.System.Logger.Level.INFO;
|
||||
|
||||
/**
|
||||
* IdGenerator for (pseudo) type 1 UUIDs.
|
||||
*
|
||||
@@ -105,7 +106,7 @@ public class UuidV1RndIdGenerator implements PlatformIdGenerator {
|
||||
|
||||
delta = current - last;
|
||||
if (delta < -10000 * 20000) {
|
||||
log.log(Level.INFO, "Clock skew of {} ms detected", delta / -10000);
|
||||
log.log(INFO, "Clock skew of {} ms detected", delta / -10000);
|
||||
// The clock was adjusted back about 2 seconds, or we were generating a lot of ids too fast
|
||||
// if so, we try to set the current as last and also increment the clockSeq.
|
||||
lock.lock();
|
||||
|
||||
@@ -2,7 +2,8 @@ package io.ebeaninternal.server.logger;
|
||||
|
||||
import io.ebeaninternal.api.SpiLogger;
|
||||
|
||||
import java.lang.System.Logger.Level;
|
||||
import static java.lang.System.Logger.Level.DEBUG;
|
||||
import static java.lang.System.Logger.Level.TRACE;
|
||||
|
||||
final class DSpiLogger implements SpiLogger {
|
||||
|
||||
@@ -14,21 +15,21 @@ final class DSpiLogger implements SpiLogger {
|
||||
|
||||
@Override
|
||||
public boolean isDebug() {
|
||||
return logger.isLoggable(Level.DEBUG);
|
||||
return logger.isLoggable(DEBUG);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTrace() {
|
||||
return logger.isLoggable(Level.TRACE);
|
||||
return logger.isLoggable(TRACE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void debug(String msg) {
|
||||
logger.log(Level.DEBUG, msg);
|
||||
logger.log(DEBUG, msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void trace(String msg) {
|
||||
logger.log(Level.TRACE, msg);
|
||||
logger.log(TRACE, msg);
|
||||
}
|
||||
}
|
||||
@@ -6,13 +6,14 @@ import io.ebeaninternal.api.SpiTransaction;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static java.lang.System.Logger.Level.WARNING;
|
||||
|
||||
/**
|
||||
* A batched statement that is held in BatchedPstmtHolder. It has a list of
|
||||
* BatchPostExecute which it will process after the statement is executed.
|
||||
@@ -136,7 +137,7 @@ public final class BatchedPstmt implements SpiProfileTransactionEvent {
|
||||
try {
|
||||
pstmt.close();
|
||||
} catch (SQLException e) {
|
||||
CoreLog.log.log(Level.WARNING, "BatchedPstmt Error closing statement", e);
|
||||
CoreLog.log.log(WARNING, "BatchedPstmt Error closing statement", e);
|
||||
} finally {
|
||||
pstmt = null;
|
||||
}
|
||||
@@ -202,7 +203,7 @@ public final class BatchedPstmt implements SpiProfileTransactionEvent {
|
||||
try {
|
||||
inputStream.close();
|
||||
} catch (IOException e) {
|
||||
CoreLog.log.log(Level.WARNING, "BatchedPstmt Error closing inputStream ", e);
|
||||
CoreLog.log.log(WARNING, "BatchedPstmt Error closing inputStream ", e);
|
||||
}
|
||||
}
|
||||
inputStreams = null;
|
||||
|
||||
@@ -12,12 +12,13 @@ import io.ebeaninternal.server.persist.platform.MultiValueBind;
|
||||
import io.ebeaninternal.server.type.*;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.*;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import static java.lang.System.Logger.Level.WARNING;
|
||||
|
||||
/**
|
||||
* Binds bean values to a PreparedStatement.
|
||||
*/
|
||||
@@ -133,7 +134,7 @@ public final class Binder {
|
||||
}
|
||||
|
||||
} catch (SQLException ex) {
|
||||
CoreLog.log.log(Level.WARNING, "error binding parameter [{0}][{1}]", (dataBind.currentPos() - 1), value);
|
||||
CoreLog.log.log(WARNING, "error binding parameter [{0}][{1}]", (dataBind.currentPos() - 1), value);
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,10 +13,12 @@ import io.ebeaninternal.server.core.*;
|
||||
import io.ebeaninternal.server.core.PersistRequest.Type;
|
||||
import io.ebeaninternal.server.deploy.*;
|
||||
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.sql.SQLException;
|
||||
import java.util.*;
|
||||
|
||||
import static java.lang.System.Logger.Level.DEBUG;
|
||||
import static java.lang.System.Logger.Level.TRACE;
|
||||
|
||||
/**
|
||||
* Persister implementation using DML.
|
||||
* <p>
|
||||
@@ -143,7 +145,7 @@ public final class DefaultPersister implements Persister {
|
||||
DraftHandler<T> draftHandler = new DraftHandler<>(desc, transaction);
|
||||
|
||||
List<T> liveBeans = draftHandler.fetchSourceBeans(query, false);
|
||||
PUB.log(Level.DEBUG, "draftRestore [{0}] count[{1}]", desc.name(), liveBeans.size());
|
||||
PUB.log(DEBUG, "draftRestore [{0}] count[{1}]", desc.name(), liveBeans.size());
|
||||
if (liveBeans.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
@@ -156,11 +158,11 @@ public final class DefaultPersister implements Persister {
|
||||
// reset @DraftDirty and @DraftReset properties
|
||||
draftHandler.resetDraft(draftBean);
|
||||
|
||||
PUB.log(Level.TRACE, "draftRestore bean [{0}] id[{1}]", desc.name(), draftHandler.getId());
|
||||
PUB.log(TRACE, "draftRestore bean [{0}] id[{1}]", desc.name(), draftHandler.getId());
|
||||
update(createRequest(draftBean, transaction, null, mgr, Type.UPDATE, Flags.RECURSE));
|
||||
}
|
||||
|
||||
PUB.log(Level.DEBUG, "draftRestore - complete for [{0}]", desc.name());
|
||||
PUB.log(DEBUG, "draftRestore - complete for [{0}]", desc.name());
|
||||
return draftHandler.getDrafts();
|
||||
}
|
||||
|
||||
@@ -185,7 +187,7 @@ public final class DefaultPersister implements Persister {
|
||||
DraftHandler<T> draftHandler = new DraftHandler<>(desc, transaction);
|
||||
|
||||
List<T> draftBeans = draftHandler.fetchSourceBeans(query, true);
|
||||
PUB.log(Level.DEBUG, "publish [{0}] count[{1}]", desc.name(), draftBeans.size());
|
||||
PUB.log(DEBUG, "publish [{0}] count[{1}]", desc.name(), draftBeans.size());
|
||||
if (draftBeans.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
@@ -202,7 +204,7 @@ public final class DefaultPersister implements Persister {
|
||||
draftHandler.resetDraft(draftBean);
|
||||
|
||||
Type persistType = draftHandler.isInsert() ? Type.INSERT : Type.UPDATE;
|
||||
PUB.log(Level.TRACE, "publish bean [{0}] id[{1}] type[{2}]", desc.name(), draftHandler.getId(), persistType);
|
||||
PUB.log(TRACE, "publish bean [{0}] id[{1}] type[{2}]", desc.name(), draftHandler.getId(), persistType);
|
||||
|
||||
PersistRequestBean<T> request = createRequest(liveBean, transaction, null, mgr, persistType, Flags.PUBLISH_RECURSE);
|
||||
if (persistType == Type.INSERT) {
|
||||
@@ -214,7 +216,7 @@ public final class DefaultPersister implements Persister {
|
||||
}
|
||||
|
||||
draftHandler.updateDrafts(transaction, mgr);
|
||||
PUB.log(Level.DEBUG, "publish - complete for [{0}]", desc.name());
|
||||
PUB.log(DEBUG, "publish - complete for [{0}]", desc.name());
|
||||
return livePublish;
|
||||
}
|
||||
|
||||
@@ -270,7 +272,7 @@ public final class DefaultPersister implements Persister {
|
||||
void updateDrafts(Transaction transaction, BeanManager<T> mgr) {
|
||||
if (!draftUpdates.isEmpty()) {
|
||||
// update the dirty status on the drafts that have been published
|
||||
PUB.log(Level.DEBUG, "publish - update dirty status on [{0}] drafts", draftUpdates.size());
|
||||
PUB.log(DEBUG, "publish - update dirty status on [{0}] drafts", draftUpdates.size());
|
||||
for (T draftUpdate : draftUpdates) {
|
||||
update(createRequest(draftUpdate, transaction, null, mgr, Type.UPDATE, Flags.ZERO));
|
||||
}
|
||||
@@ -491,8 +493,8 @@ public final class DefaultPersister implements Persister {
|
||||
}
|
||||
if (request.isDirty()) {
|
||||
request.executeOrQueue();
|
||||
} else if (log.isLoggable(Level.DEBUG)) {
|
||||
log.log(Level.DEBUG, "Update skipped as bean is unchanged: {0}", request.bean());
|
||||
} else if (log.isLoggable(DEBUG)) {
|
||||
log.log(DEBUG, "Update skipped as bean is unchanged: {0}", request.bean());
|
||||
}
|
||||
if (request.isPersistCascade()) {
|
||||
// save all the beans in assocMany's after
|
||||
@@ -538,8 +540,8 @@ public final class DefaultPersister implements Persister {
|
||||
if (req.isRegisteredForDeleteBean()) {
|
||||
// skip deleting bean. Used where cascade is on
|
||||
// both sides of a relationship
|
||||
if (log.isLoggable(Level.DEBUG)) {
|
||||
log.log(Level.DEBUG, "skipping delete on alreadyRegistered {0}", req.bean());
|
||||
if (log.isLoggable(DEBUG)) {
|
||||
log.log(DEBUG, "skipping delete on alreadyRegistered {0}", req.bean());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,8 @@ import io.ebeaninternal.server.core.PersistRequestBean;
|
||||
import io.ebeaninternal.server.deploy.BeanPropertyAssocMany;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.System.Logger.Level;
|
||||
|
||||
import static java.lang.System.Logger.Level.ERROR;
|
||||
|
||||
/**
|
||||
* Base for saving entity bean collections and element collections.
|
||||
@@ -72,7 +73,7 @@ abstract class SaveManyBase implements SaveMany {
|
||||
String asJson = many.jsonWriteCollection(value);
|
||||
request.addCollectionChange(many.name(), asJson);
|
||||
} catch (IOException e) {
|
||||
CoreLog.log.log(Level.ERROR, "Error build element collection entry for L2 cache", e);
|
||||
CoreLog.log.log(ERROR, "Error build element collection entry for L2 cache", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,12 +7,12 @@ import io.ebeaninternal.api.*;
|
||||
import io.ebeaninternal.server.transaction.TransactionManager;
|
||||
import io.ebeaninternal.server.type.bindcapture.BindCapture;
|
||||
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import static java.lang.System.Logger.Level.ERROR;
|
||||
import static java.util.Collections.emptyList;
|
||||
|
||||
public final class CQueryPlanManager implements QueryPlanManager {
|
||||
@@ -65,7 +65,7 @@ public final class CQueryPlanManager implements QueryPlanManager {
|
||||
}
|
||||
return req.plans();
|
||||
} catch (SQLException e) {
|
||||
CoreLog.log.log(Level.ERROR, "Error during query plan collection", e);
|
||||
CoreLog.log.log(ERROR, "Error during query plan collection", e);
|
||||
return emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,9 +12,10 @@ import io.ebeaninternal.server.deploy.TableJoin;
|
||||
import io.ebeaninternal.server.querydefn.OrmQueryDetail;
|
||||
import io.ebeaninternal.server.querydefn.OrmQueryProperties;
|
||||
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.*;
|
||||
|
||||
import static java.lang.System.Logger.Level.ERROR;
|
||||
|
||||
/**
|
||||
* Factory for SqlTree.
|
||||
*/
|
||||
@@ -385,7 +386,7 @@ public final class SqlTreeBuilder {
|
||||
private void addPropertyToSubQuery(SqlTreeProperties selectProps, STreeType desc, String propName, String path) {
|
||||
STreeProperty p = desc.findPropertyWithDynamic(propName, path);
|
||||
if (p == null) {
|
||||
log.log(Level.ERROR, "property [{0}] not found on {1} for query - excluding it.", propName, desc);
|
||||
log.log(ERROR, "property [{0}] not found on {1} for query - excluding it.", propName, desc);
|
||||
return;
|
||||
} else if (p instanceof STreePropertyAssoc && p.isEmbedded()) {
|
||||
// if the property is embedded we need to lookup the real column name
|
||||
@@ -420,13 +421,13 @@ public final class SqlTreeBuilder {
|
||||
if (p != null) {
|
||||
selectProps.add(p);
|
||||
} else {
|
||||
log.log(Level.ERROR, "property [{0}] not found on {1} for query - excluding it.", propName, desc);
|
||||
log.log(ERROR, "property [{0}] not found on {1} for query - excluding it.", propName, desc);
|
||||
}
|
||||
} else if (p.isEmbedded() || (p instanceof STreePropertyAssoc && !queryProps.isIncludedBeanJoin(p.name()))) {
|
||||
// add the embedded bean or the *ToOne assoc bean. We skip the check that the *ToOne propName maps to Id property ...
|
||||
selectProps.add(p);
|
||||
} else {
|
||||
log.log(Level.ERROR, "property [{0}] expected to be an embedded or *ToOne bean for query - excluding it.", p.fullName());
|
||||
log.log(ERROR, "property [{0}] expected to be an embedded or *ToOne bean for query - excluding it.", p.fullName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -435,7 +436,7 @@ public final class SqlTreeBuilder {
|
||||
// sub class hierarchy if required
|
||||
STreeProperty p = desc.findPropertyWithDynamic(propName, queryProps.getPath());
|
||||
if (p == null) {
|
||||
log.log(Level.ERROR, "property [{0}] not found on {1} for query - excluding it.", propName, desc);
|
||||
log.log(ERROR, "property [{0}] not found on {1} for query - excluding it.", propName, desc);
|
||||
p = desc.findProperty("id");
|
||||
selectProps.add(p);
|
||||
|
||||
|
||||
+7
-5
@@ -11,9 +11,11 @@ import io.ebeaninternal.api.CoreLog;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.Map;
|
||||
|
||||
import static java.lang.System.Logger.Level.ERROR;
|
||||
import static java.lang.System.Logger.Level.INFO;
|
||||
|
||||
/**
|
||||
* Default implementation of ReadAuditLogger that writes the event in JSON format to standard loggers.
|
||||
*/
|
||||
@@ -48,9 +50,9 @@ public class DefaultReadAuditLogger implements ReadAuditLogger {
|
||||
}
|
||||
gen.writeEndObject();
|
||||
gen.flush();
|
||||
queryLogger.log(Level.INFO, writer.toString());
|
||||
queryLogger.log(INFO, writer.toString());
|
||||
} catch (IOException e) {
|
||||
CoreLog.log.log(Level.ERROR, "Error writing Read audit event", e);
|
||||
CoreLog.log.log(ERROR, "Error writing Read audit event", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,9 +77,9 @@ public class DefaultReadAuditLogger implements ReadAuditLogger {
|
||||
StringWriter writer = new StringWriter(defaultReadBuffer);
|
||||
JsonGenerator gen = jsonFactory.createGenerator(writer);
|
||||
writeDetails(gen, event);
|
||||
auditLogger.log(Level.INFO, writer.toString());
|
||||
auditLogger.log(INFO, writer.toString());
|
||||
} catch (IOException e) {
|
||||
CoreLog.log.log(Level.ERROR, "Error writing Read audit event", e);
|
||||
CoreLog.log.log(ERROR, "Error writing Read audit event", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+10
-10
@@ -11,7 +11,6 @@ import io.ebeaninternal.api.SpiProfileHandler;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.format.DateTimeFormatterBuilder;
|
||||
@@ -22,6 +21,7 @@ import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import static java.lang.System.Logger.Level.*;
|
||||
import static java.time.temporal.ChronoField.*;
|
||||
|
||||
/**
|
||||
@@ -79,7 +79,7 @@ public final class DefaultProfileHandler implements SpiProfileHandler, Plugin {
|
||||
this.executor = Executors.newSingleThreadExecutor();
|
||||
this.dir = new File(config.getDirectory());
|
||||
if (!dir.exists() && !dir.mkdirs()) {
|
||||
log.log(Level.ERROR, "failed to mkdirs " + dir.getAbsolutePath());
|
||||
log.log(ERROR, "failed to mkdirs " + dir.getAbsolutePath());
|
||||
}
|
||||
incrementFile();
|
||||
}
|
||||
@@ -109,7 +109,7 @@ public final class DefaultProfileHandler implements SpiProfileHandler, Plugin {
|
||||
out.close();
|
||||
out = null;
|
||||
} catch (IOException e) {
|
||||
log.log(Level.ERROR, "Failed to flush and close transaction profiling file ", e);
|
||||
log.log(ERROR, "Failed to flush and close transaction profiling file ", e);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
@@ -129,7 +129,7 @@ public final class DefaultProfileHandler implements SpiProfileHandler, Plugin {
|
||||
File file = new File(dir, "txprofile-" + now + ".tprofile");
|
||||
out = IOUtils.newWriter(file);
|
||||
} catch (IOException e) {
|
||||
log.log(Level.ERROR, "Not expected", e);
|
||||
log.log(ERROR, "Not expected", e);
|
||||
}
|
||||
} finally {
|
||||
lock.unlock();
|
||||
@@ -152,7 +152,7 @@ public final class DefaultProfileHandler implements SpiProfileHandler, Plugin {
|
||||
}
|
||||
flushCurrentFile();
|
||||
} catch (Exception e) {
|
||||
log.log(Level.WARNING, "Error on collect", e);
|
||||
log.log(WARNING, "Error on collect", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,10 +183,10 @@ public final class DefaultProfileHandler implements SpiProfileHandler, Plugin {
|
||||
|
||||
if (profileCounter % profilesPerFile == 0) {
|
||||
incrementFile();
|
||||
log.log(Level.DEBUG, "profiled {0} transactions", profileCounter);
|
||||
log.log(DEBUG, "profiled {0} transactions", profileCounter);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.log(Level.WARNING, "Error writing transaction profiling", e);
|
||||
log.log(WARNING, "Error writing transaction profiling", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,16 +250,16 @@ public final class DefaultProfileHandler implements SpiProfileHandler, Plugin {
|
||||
@Override
|
||||
public void shutdown() {
|
||||
shutdown = true;
|
||||
log.log(Level.TRACE, "shutting down");
|
||||
log.log(TRACE, "shutting down");
|
||||
try {
|
||||
executor.shutdown();
|
||||
if (!executor.awaitTermination(4, TimeUnit.SECONDS)) {
|
||||
log.log(Level.INFO, "Shut down timeout exceeded. Terminating profiling consumer thread.");
|
||||
log.log(INFO, "Shut down timeout exceeded. Terminating profiling consumer thread.");
|
||||
executor.shutdownNow();
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
log.log(Level.WARNING, "Interrupt on shutdown", e);
|
||||
log.log(WARNING, "Interrupt on shutdown", e);
|
||||
}
|
||||
flushCurrentFile();
|
||||
}
|
||||
|
||||
+3
-2
@@ -12,12 +12,13 @@ import io.ebeaninternal.server.persist.BatchControl;
|
||||
import io.ebeanservice.docstore.api.DocStoreTransaction;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static java.lang.System.Logger.Level.ERROR;
|
||||
|
||||
/**
|
||||
* Read only transaction expected to use autoCommit connection and for implicit use only.
|
||||
* <p>
|
||||
@@ -484,7 +485,7 @@ final class ImplicitReadOnlyTransaction implements SpiTransaction, TxnProfileEve
|
||||
} catch (Exception ex) {
|
||||
// the connection pool will automatically remove the
|
||||
// connection if it does not pass the test
|
||||
CoreLog.log.log(Level.ERROR, "Error closing connection", ex);
|
||||
CoreLog.log.log(ERROR, "Error closing connection", ex);
|
||||
}
|
||||
connection = null;
|
||||
active = false;
|
||||
|
||||
@@ -17,12 +17,13 @@ import io.ebeanservice.docstore.api.DocStoreTransaction;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
import javax.persistence.RollbackException;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import static java.lang.System.Logger.Level.ERROR;
|
||||
|
||||
/**
|
||||
* JDBC Connection based transaction.
|
||||
*/
|
||||
@@ -356,7 +357,7 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
try {
|
||||
consumer.accept(callbackList.get(i));
|
||||
} catch (Exception e) {
|
||||
log.log(Level.ERROR, "Error executing transaction callback", e);
|
||||
log.log(ERROR, "Error executing transaction callback", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -884,7 +885,7 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
connection.setReadOnly(false);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
log.log(Level.ERROR, "Error setting to readOnly?", e);
|
||||
log.log(ERROR, "Error setting to readOnly?", e);
|
||||
}
|
||||
try {
|
||||
if (autoCommit) {
|
||||
@@ -892,14 +893,14 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
connection.setAutoCommit(true);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
log.log(Level.ERROR, "Error setting to readOnly?", e);
|
||||
log.log(ERROR, "Error setting to readOnly?", e);
|
||||
}
|
||||
try {
|
||||
connection.close();
|
||||
} catch (Exception ex) {
|
||||
// the connection pool will automatically remove the
|
||||
// connection if it does not pass the test
|
||||
log.log(Level.ERROR, "Error closing connection", ex);
|
||||
log.log(ERROR, "Error closing connection", ex);
|
||||
}
|
||||
connection = null;
|
||||
active = false;
|
||||
@@ -932,7 +933,7 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
}
|
||||
withEachCallback(TransactionCallback::postCommit);
|
||||
} catch (SQLException e) {
|
||||
log.log(Level.ERROR, "Error when ending a query only transaction via " + onQueryOnly, e);
|
||||
log.log(ERROR, "Error when ending a query only transaction via " + onQueryOnly, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+9
-7
@@ -13,7 +13,9 @@ import javax.transaction.Status;
|
||||
import javax.transaction.Synchronization;
|
||||
import javax.transaction.TransactionSynchronizationRegistry;
|
||||
import javax.transaction.UserTransaction;
|
||||
import java.lang.System.Logger.Level;
|
||||
|
||||
import static java.lang.System.Logger.Level.DEBUG;
|
||||
import static java.lang.System.Logger.Level.WARNING;
|
||||
|
||||
/**
|
||||
* Hook into external JTA transaction manager.
|
||||
@@ -87,15 +89,15 @@ public final class JtaTransactionManager implements ExternalTransactionManager {
|
||||
SpiTransaction currentEbeanTransaction = scope.inScope();
|
||||
if (currentEbeanTransaction != null) {
|
||||
// NOT expecting this so log WARNING
|
||||
log.log(Level.WARNING, "JTA Transaction - no current txn BUT using current Ebean one {0}", currentEbeanTransaction.getId());
|
||||
log.log(WARNING, "JTA Transaction - no current txn BUT using current Ebean one {0}", currentEbeanTransaction.getId());
|
||||
return currentEbeanTransaction;
|
||||
}
|
||||
|
||||
UserTransaction ut = getUserTransaction();
|
||||
if (ut == null) {
|
||||
// no current JTA transaction
|
||||
if (log.isLoggable(Level.DEBUG)) {
|
||||
log.log(Level.DEBUG, "JTA Transaction - no current txn");
|
||||
if (log.isLoggable(DEBUG)) {
|
||||
log.log(DEBUG, "JTA Transaction - no current txn");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -181,21 +183,21 @@ public final class JtaTransactionManager implements ExternalTransactionManager {
|
||||
public void afterCompletion(int status) {
|
||||
switch (status) {
|
||||
case Status.STATUS_COMMITTED:
|
||||
log.log(Level.DEBUG, "Jta Txn [{0}] committed", transaction.getId());
|
||||
log.log(DEBUG, "Jta Txn [{0}] committed", transaction.getId());
|
||||
transaction.postCommit();
|
||||
// Remove this transaction object as it is completed
|
||||
transactionManager.scope().clearExternal();
|
||||
break;
|
||||
|
||||
case Status.STATUS_ROLLEDBACK:
|
||||
log.log(Level.DEBUG, "Jta Txn [{0}] rollback", transaction.getId());
|
||||
log.log(DEBUG, "Jta Txn [{0}] rollback", transaction.getId());
|
||||
transaction.postRollback(null);
|
||||
// Remove this transaction object as it is completed
|
||||
transactionManager.scope().clearExternal();
|
||||
break;
|
||||
|
||||
default:
|
||||
log.log(Level.DEBUG, "Jta Txn [{0}] status:{1}", transaction.getId(), status);
|
||||
log.log(DEBUG, "Jta Txn [{0}] status:{1}", transaction.getId(), status);
|
||||
}
|
||||
|
||||
// No matter the completion status of the transaction, we release the connection we got from the pool.
|
||||
|
||||
+4
-3
@@ -11,10 +11,11 @@ import io.ebeaninternal.server.cluster.ClusterManager;
|
||||
import io.ebeaninternal.server.core.PersistRequestBean;
|
||||
import io.ebeanservice.docstore.api.DocStoreUpdates;
|
||||
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static java.lang.System.Logger.Level.DEBUG;
|
||||
|
||||
/**
|
||||
* Performs post commit processing using a background thread.
|
||||
* <p>
|
||||
@@ -104,8 +105,8 @@ final class PostCommitProcessing {
|
||||
private void notifyCluster() {
|
||||
if (remoteTransactionEvent != null && !remoteTransactionEvent.isEmpty()) {
|
||||
// send the interesting events to the cluster
|
||||
if (log.isLoggable(Level.DEBUG)) {
|
||||
log.log(Level.DEBUG, "Cluster Send: {0}", remoteTransactionEvent);
|
||||
if (log.isLoggable(DEBUG)) {
|
||||
log.log(DEBUG, "Cluster Send: {0}", remoteTransactionEvent);
|
||||
}
|
||||
clusterManager.broadcast(remoteTransactionEvent);
|
||||
}
|
||||
|
||||
@@ -6,11 +6,13 @@ import io.ebean.cache.QueryCacheEntryValidate;
|
||||
import io.ebean.cache.ServerCacheNotification;
|
||||
import io.ebean.cache.ServerCacheNotify;
|
||||
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import static java.lang.System.Logger.Level.DEBUG;
|
||||
import static java.lang.System.Logger.Level.TRACE;
|
||||
|
||||
/**
|
||||
* Holds timestamp of last modification per table.
|
||||
* <p>
|
||||
@@ -34,8 +36,8 @@ public final class TableModState implements QueryCacheEntryValidate, ServerCache
|
||||
for (String tableName : touchedTables) {
|
||||
tableModStamp.put(tableName, modNanoTime);
|
||||
}
|
||||
if (log.isLoggable(Level.DEBUG)) {
|
||||
log.log(Level.DEBUG, "TableModState updated - touched:{0} modNanoTime:{1}", touchedTables, modNanoTime);
|
||||
if (log.isLoggable(DEBUG)) {
|
||||
log.log(DEBUG, "TableModState updated - touched:{0} modNanoTime:{1}", touchedTables, modNanoTime);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,8 +48,8 @@ public final class TableModState implements QueryCacheEntryValidate, ServerCache
|
||||
for (String tableName : tables) {
|
||||
Long modTime = tableModStamp.get(tableName);
|
||||
if (modTime != null && modTime >= sinceNanoTime) {
|
||||
if (log.isLoggable(Level.TRACE)) {
|
||||
log.log(Level.TRACE, "Invalidate on table:{0}", tableName);
|
||||
if (log.isLoggable(TRACE)) {
|
||||
log.log(TRACE, "Invalidate on table:{0}", tableName);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -73,8 +75,8 @@ public final class TableModState implements QueryCacheEntryValidate, ServerCache
|
||||
public void notify(ServerCacheNotification notification) {
|
||||
// use local clock - for slightly more aggressive invalidation (as later)
|
||||
// that removes any concern regarding clock syncing across cluster
|
||||
if (log.isLoggable(Level.DEBUG)) {
|
||||
log.log(Level.DEBUG, "ServerCacheNotification:{0}", notification);
|
||||
if (log.isLoggable(DEBUG)) {
|
||||
log.log(DEBUG, "ServerCacheNotification:{0}", notification);
|
||||
}
|
||||
touch(notification.getDependentTables());
|
||||
}
|
||||
@@ -87,8 +89,8 @@ public final class TableModState implements QueryCacheEntryValidate, ServerCache
|
||||
public void notify(RemoteTableMod tableMod) {
|
||||
// use local clock - for slightly more aggressive invalidation (as later)
|
||||
// that removes any concern regarding clock syncing across cluster
|
||||
if (log.isLoggable(Level.DEBUG)) {
|
||||
log.log(Level.DEBUG, "RemoteTableMod:{0}", tableMod);
|
||||
if (log.isLoggable(DEBUG)) {
|
||||
log.log(DEBUG, "RemoteTableMod:{0}", tableMod);
|
||||
}
|
||||
touch(tableMod.getTables());
|
||||
}
|
||||
|
||||
+7
-5
@@ -32,7 +32,6 @@ import io.ebeanservice.docstore.api.DocStoreUpdates;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
import javax.sql.DataSource;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
@@ -40,6 +39,9 @@ import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import static java.lang.System.Logger.Level.DEBUG;
|
||||
import static java.lang.System.Logger.Level.ERROR;
|
||||
|
||||
/**
|
||||
* Manages transactions.
|
||||
* <p>
|
||||
@@ -365,7 +367,7 @@ public class TransactionManager implements SpiTransactionManager {
|
||||
txnLogger.debug(msg);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
log.log(Level.ERROR, "Error while notifying TransactionEventListener of rollback event", ex);
|
||||
log.log(ERROR, "Error while notifying TransactionEventListener of rollback event", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -416,7 +418,7 @@ public class TransactionManager implements SpiTransactionManager {
|
||||
postCommit.notifyLocalCache();
|
||||
backgroundExecutor.execute(postCommit.backgroundNotify());
|
||||
} catch (Exception ex) {
|
||||
log.log(Level.ERROR, "NotifyOfCommit failed. L2 Cache potentially not notified.", ex);
|
||||
log.log(ERROR, "NotifyOfCommit failed. L2 Cache potentially not notified.", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -442,8 +444,8 @@ public class TransactionManager implements SpiTransactionManager {
|
||||
* Notify local BeanPersistListeners etc of events from another server in the cluster.
|
||||
*/
|
||||
public final void remoteTransactionEvent(RemoteTransactionEvent remoteEvent) {
|
||||
if (clusterLogger.isLoggable(Level.DEBUG)) {
|
||||
clusterLogger.log(Level.DEBUG, "processing {0}", remoteEvent);
|
||||
if (clusterLogger.isLoggable(DEBUG)) {
|
||||
clusterLogger.log(DEBUG, "processing {0}", remoteEvent);
|
||||
}
|
||||
CacheChangeSet changeSet = new CacheChangeSet();
|
||||
|
||||
|
||||
@@ -5,13 +5,14 @@ import io.ebeaninternal.api.CoreLog;
|
||||
import io.ebeaninternal.server.core.timezone.DataTimeZone;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
import static java.lang.System.Logger.Level.WARNING;
|
||||
|
||||
public class DataBind implements DataBinder {
|
||||
|
||||
private final DataTimeZone dataTimeZone;
|
||||
@@ -101,7 +102,7 @@ public class DataBind implements DataBinder {
|
||||
try {
|
||||
inputStream.close();
|
||||
} catch (IOException e) {
|
||||
CoreLog.log.log(Level.WARNING, "Error closing InputStream that was bound to PreparedStatement", e);
|
||||
CoreLog.log.log(WARNING, "Error closing InputStream that was bound to PreparedStatement", e);
|
||||
}
|
||||
}
|
||||
inputStreams = null;
|
||||
|
||||
@@ -29,7 +29,6 @@ import org.joda.time.LocalTime;
|
||||
import javax.persistence.AttributeConverter;
|
||||
import javax.persistence.EnumType;
|
||||
import java.io.File;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
@@ -45,6 +44,8 @@ import java.time.*;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import static java.lang.System.Logger.Level.*;
|
||||
|
||||
/**
|
||||
* Default implementation of TypeManager.
|
||||
* <p>
|
||||
@@ -219,10 +220,10 @@ public final class DefaultTypeManager implements TypeManager {
|
||||
}
|
||||
|
||||
private void logAdd(ScalarType<?> scalarType) {
|
||||
if (log.isLoggable(Level.TRACE)) {
|
||||
if (log.isLoggable(TRACE)) {
|
||||
String msg = "ScalarType register [" + scalarType.getClass().getName() + "]";
|
||||
msg += " for [" + scalarType.getType().getName() + "]";
|
||||
log.log(Level.TRACE, msg);
|
||||
log.log(TRACE, msg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -675,7 +676,7 @@ public final class DefaultTypeManager implements TypeManager {
|
||||
}
|
||||
add(scalarType);
|
||||
} catch (Exception e) {
|
||||
log.log(Level.ERROR, "Error loading ScalarType [" + cls.getName() + "]", e);
|
||||
log.log(ERROR, "Error loading ScalarType [" + cls.getName() + "]", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -706,10 +707,10 @@ public final class DefaultTypeManager implements TypeManager {
|
||||
}
|
||||
ScalarTypeConverter converter = foundType.getDeclaredConstructor().newInstance();
|
||||
ScalarTypeWrapper stw = new ScalarTypeWrapper(logicalType, wrappedType, converter);
|
||||
log.log(Level.DEBUG, "Register ScalarTypeWrapper from {0} -> {1} using:{2}", logicalType, persistType, foundType);
|
||||
log.log(DEBUG, "Register ScalarTypeWrapper from {0} -> {1} using:{2}", logicalType, persistType, foundType);
|
||||
add(stw);
|
||||
} catch (Exception e) {
|
||||
log.log(Level.ERROR, "Error registering ScalarTypeConverter [" + foundType.getName() + "]", e);
|
||||
log.log(ERROR, "Error registering ScalarTypeConverter [" + foundType.getName() + "]", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -730,10 +731,10 @@ public final class DefaultTypeManager implements TypeManager {
|
||||
}
|
||||
AttributeConverter converter = foundType.getDeclaredConstructor().newInstance();
|
||||
ScalarTypeWrapper stw = new ScalarTypeWrapper(logicalType, wrappedType, new AttributeConverterAdapter(converter));
|
||||
log.log(Level.DEBUG, "Register ScalarTypeWrapper from {0} -> {1} using:{2}", logicalType, persistType, foundType);
|
||||
log.log(DEBUG, "Register ScalarTypeWrapper from {0} -> {1} using:{2}", logicalType, persistType, foundType);
|
||||
add(stw);
|
||||
} catch (Exception e) {
|
||||
log.log(Level.ERROR, "Error registering AttributeConverter [" + foundType.getName() + "]", e);
|
||||
log.log(ERROR, "Error registering AttributeConverter [" + foundType.getName() + "]", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -805,7 +806,7 @@ public final class DefaultTypeManager implements TypeManager {
|
||||
// detect if Joda classes are in the classpath
|
||||
if (config.getClassLoadConfig().isJodaTimePresent()) {
|
||||
// Joda classes are in the classpath so register the types
|
||||
log.log(Level.DEBUG, "Registering Joda data types");
|
||||
log.log(DEBUG, "Registering Joda data types");
|
||||
addType(LocalDateTime.class, new ScalarTypeJodaLocalDateTime(jsonDateTime));
|
||||
addType(DateTime.class, new ScalarTypeJodaDateTime(jsonDateTime));
|
||||
if (config.getDatabasePlatform().supportsNativeJavaTime()) {
|
||||
|
||||
@@ -9,10 +9,11 @@ import io.ebean.text.TextException;
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Types;
|
||||
|
||||
import static java.lang.System.Logger.Level.ERROR;
|
||||
|
||||
/**
|
||||
* ScalarType for streaming between a File and the database.
|
||||
*/
|
||||
@@ -170,14 +171,14 @@ final class ScalarTypeFile extends ScalarTypeBase<File> {
|
||||
try {
|
||||
output.close();
|
||||
} catch (IOException e) {
|
||||
CoreLog.log.log(Level.ERROR, "Error when closing outputStream", e);
|
||||
CoreLog.log.log(ERROR, "Error when closing outputStream", e);
|
||||
}
|
||||
}
|
||||
if (input != null) {
|
||||
try {
|
||||
input.close();
|
||||
} catch (IOException e) {
|
||||
CoreLog.log.log(Level.ERROR, "Error when closing inputStream ", e);
|
||||
CoreLog.log.log(ERROR, "Error when closing inputStream ", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user