void setMaxRetainSize(int maxRetainSize) { LOGGER_CONNECTION.warn("Unsafe method called. Use configuration parameters to set this value instead"); this.maxRetainSize = maxRetainSize; } }
void setMaxAge(long maxAge) { LOGGER_CONNECTION.warn("Unsafe method called. Use configuration parameters to set this value instead"); this.maxAge = maxAge; }
public static void trip(Class<?> trippingClass, String msg) { LOGGER.warn(trippingClass.getName() + ", " + msg); }
private <T> T readSilent(ResultSet rs, SqlSupplier<T> supplier, boolean fullWarning) { try { final T result = supplier.get(); if (rs.wasNull()) { return null; } else { return result; } } catch (SQLException sqle) { // ignore, just return null if (fullWarning) { LOGGER.warn(sqle, "Unable to read column metadata: " + sqle.getMessage()); } else { LOGGER.info("Metadata not supported: " + sqle.getMessage()); } } return null; }
@ExecuteBefore(STARTED) void checkSpeedmentVersion(Injector injector) { injector.get(InfoComponent.class).ifPresent(ic -> { final String expected = ic.getEditionAndVersionString(); final String actual = project.getSpeedmentVersion().orElse(null); if (!expected.equals(actual)) { LOGGER.warn(format( "Code generated using '%s' and running with '%s'. Make sure " + "versions and editions match to avoid performance and " + "stability issues.", actual, expected)); } } ); }
LOGGER.warn("Enum spaces will be converted to underscores in Java"); return value; } else {
private void blockUntilAvailable() { if (closed) { throw new IllegalStateException("This connection has already been closed."); } if (!available) { LOGGER_CONNECTION.debug("Aquiring connection"); try { if (!lock.tryAcquire()) { if (blocking) { LOGGER_CONNECTION.warn("Waiting for connection to become available..."); lock.acquire(); } else { throw new SpeedmentException( "Error! No connection available. Try " + "wrapping the expression in a transaction or " + "enable the Speedment parameter " + "'connectionpool.blocking=true'."); } } } catch (final InterruptedException ex) { throw new SpeedmentException( "Interrupted while waiting for available connection.", ex); } this.counter.incrementAndGet(); available = true; } } }
@ExecuteBefore(State.STOPPED) void closeOpenConnections() { leasedConnections.values().forEach(conn -> { try { if (!conn.isClosed()) { conn.close(); LOGGER_CONNECTION.warn("Leased connection had to be closed automatically."); } } catch (final SQLException ex) { throw new SpeedmentException(ex); } }); pools.values().forEach(queue -> { PoolableConnection conn; while ((conn = queue.poll()) != null) { try { if (!conn.isClosed()) { conn.rawClose(); } } catch (final SQLException ex) { throw new SpeedmentException("Error closing connection.", ex); } } }); }
private void primaryKeyColumns(Connection conn, Table table, ProgressMeasure progress) { requireNonNulls(conn, table, progress); final SqlSupplier<ResultSet> supplier = () -> conn.getMetaData().getPrimaryKeys(null, null, table.getId()); final TableChildMutator<PrimaryKeyColumn> mutator = (pkc, rs) -> { final String columnName = rs.getString("COLUMN_NAME"); pkc.mutator().setId(columnName); pkc.mutator().setName(columnName); pkc.mutator().setOrdinalPosition(rs.getInt("KEY_SEQ")); }; tableChilds( table, PrimaryKeyColumn.class, table.mutator()::addNewPrimaryKeyColumn, supplier, rsChild -> rsChild.getString("COLUMN_NAME"), mutator ); if (!table.isView() && table.primaryKeyColumns().noneMatch(pk -> true)) { LOGGER.warn(format("Table '%s' does not have any primary key.", table.getId())); } }
protected void primaryKeyColumns(Connection connection, Table table, ProgressMeasure progressListener) { requireNonNulls(connection, table); final Schema schema = table.getParentOrThrow(); final SqlSupplier<ResultSet> supplier = () -> connection.getMetaData().getPrimaryKeys(jdbcCatalogLookupName(schema), jdbcSchemaLookupName(schema), metaDataTableNameForPrimaryKeys(table) ); final AbstractDbmsOperationHandler.TableChildMutator<PrimaryKeyColumn, ResultSet> mutator = (primaryKeyColumn, rs) -> { final String columnName = rs.getString("COLUMN_NAME"); primaryKeyColumn.mutator().setId(columnName); primaryKeyColumn.mutator().setName(columnName); primaryKeyColumn.mutator().setOrdinalPosition(rs.getInt("KEY_SEQ")); }; tableChilds(PrimaryKeyColumn.class, table.mutator()::addNewPrimaryKeyColumn, supplier, mutator, progressListener); if (!table.isView() && table.primaryKeyColumns().noneMatch(pk -> true)) { LOGGER.warn("Table '" + table.getId() + "' does not have any primary key."); } }
LOGGER.info(msg); if (!info.isProductionMode()) { LOGGER.warn("This version is NOT INTENDED FOR PRODUCTION USE!"); LOGGER.info("Upstream version is " + upstreamInfo.getImplementationVersion() + " (" + upstreamInfo.getSpecificationNickname() + ")"); if (!upstreamInfo.isProductionMode()) { LOGGER.warn("Upstream version is NOT INTENDED FOR PRODUCTION USE!"); if (isVersionOk.isPresent()) { if (!isVersionOk.get()) { LOGGER.warn("The current Java version (" + versionString + ") is outdated. Please upgrade to a more recent " + "Java version."); LOGGER.warn("Unable to fully parse the java version. " + "Version check skipped!");
LOGGER.warn("Creating new Speedment instance for UI session."); INJECTOR = new DefaultApplicationBuilder( getClass().getClassLoader(),
LOGGER.warn( String.format("Unable to determine mapping for table %s, column %s. " + "Type name %s, data type %d, decimal digits %d."
void setMaxRetainSize(int maxRetainSize) { LOGGER_CONNECTION.warn("Unsafe method called. Use configuration parameters to set this value instead"); this.maxRetainSize = maxRetainSize; } }
void setMaxAge(long maxAge) { LOGGER_CONNECTION.warn("Unsafe method called. Use configuration parameters to set this value instead"); this.maxAge = maxAge; }
private <T> T readSilent(ResultSet rs, SqlSupplier<T> supplier, boolean fullWarning) { try { final T result = supplier.get(); if (rs.wasNull()) { return null; } else { return result; } } catch (SQLException sqle) { // ignore, just return null if (fullWarning) { LOGGER.warn(sqle, "Unable to read column metadata: " + sqle.getMessage()); } else { LOGGER.info("Metadata not supported: " + sqle.getMessage()); } } return null; }
@ExecuteBefore(STARTED) void checkSpeedmentVersion(Injector injector) { injector.get(InfoComponent.class).ifPresent(ic -> { final String expected = ic.getEditionAndVersionString(); final String actual = project.getSpeedmentVersion().orElse(null); if (!expected.equals(actual)) { LOGGER.warn(format( "Code generated using '%s' and running with '%s'. Make sure " + "versions and editions match to avoid performance and " + "stability issues.", actual, expected)); } } ); }
@ExecuteBefore(State.STOPPED) void closeOpenConnections() { leasedConnections.values().forEach(conn -> { try { if (!conn.isClosed()) { conn.close(); LOGGER_CONNECTION.warn("Leased connection had to be closed automatically."); } } catch (final SQLException ex) { throw new SpeedmentException(ex); } }); pools.values().forEach(queue -> { PoolableConnection conn; while ((conn = queue.poll()) != null) { try { if (!conn.isClosed()) { conn.rawClose(); } } catch (final SQLException ex) { throw new SpeedmentException("Error closing connection.", ex); } } }); }
private void primaryKeyColumns(Connection conn, Table table, ProgressMeasure progress) { requireNonNulls(conn, table, progress); final SqlSupplier<ResultSet> supplier = () -> conn.getMetaData().getPrimaryKeys(null, null, table.getId()); final TableChildMutator<PrimaryKeyColumn> mutator = (pkc, rs) -> { final String columnName = rs.getString("COLUMN_NAME"); pkc.mutator().setId(columnName); pkc.mutator().setName(columnName); pkc.mutator().setOrdinalPosition(rs.getInt("KEY_SEQ")); }; tableChilds( table, PrimaryKeyColumn.class, table.mutator()::addNewPrimaryKeyColumn, supplier, rsChild -> rsChild.getString("COLUMN_NAME"), mutator ); if (!table.isView() && table.primaryKeyColumns().noneMatch(pk -> true)) { LOGGER.warn(format("Table '%s' does not have any primary key.", table.getId())); } }
protected void primaryKeyColumns(Connection connection, Table table, ProgressMeasure progressListener) { requireNonNulls(connection, table); final Schema schema = table.getParentOrThrow(); final SqlSupplier<ResultSet> supplier = () -> connection.getMetaData().getPrimaryKeys(jdbcCatalogLookupName(schema), jdbcSchemaLookupName(schema), metaDataTableNameForPrimaryKeys(table) ); final AbstractDbmsOperationHandler.TableChildMutator<PrimaryKeyColumn, ResultSet> mutator = (primaryKeyColumn, rs) -> { final String columnName = rs.getString("COLUMN_NAME"); primaryKeyColumn.mutator().setId(columnName); primaryKeyColumn.mutator().setName(columnName); primaryKeyColumn.mutator().setOrdinalPosition(rs.getInt("KEY_SEQ")); }; tableChilds(PrimaryKeyColumn.class, table.mutator()::addNewPrimaryKeyColumn, supplier, mutator, progressListener); if (!table.isView() && table.primaryKeyColumns().noneMatch(pk -> true)) { LOGGER.warn("Table '" + table.getId() + "' does not have any primary key."); } }