Skip to content

Commit

Permalink
Remove custom Supplier
Browse files Browse the repository at this point in the history
  • Loading branch information
davidegrohmann committed Dec 10, 2015
1 parent c957557 commit d3ccb94
Show file tree
Hide file tree
Showing 105 changed files with 511 additions and 967 deletions.
Expand Up @@ -25,7 +25,6 @@
import java.text.SimpleDateFormat;
import java.util.Date;

import org.neo4j.function.Supplier;
import org.neo4j.function.Suppliers;
import org.neo4j.graphdb.factory.GraphDatabaseSettings;
import org.neo4j.kernel.configuration.Settings;
Expand Down Expand Up @@ -119,18 +118,13 @@ public Result runFullConsistencyCheck( final File storeDir, Config tuningConfigu

ConsistencySummaryStatistics summary;
final File reportFile = chooseReportPath( storeDir, tuningConfiguration );
Log reportLog = new ConsistencyReportLog( Suppliers.lazySingleton( new Supplier<PrintWriter>()
{
@Override
public PrintWriter get()
Log reportLog = new ConsistencyReportLog( Suppliers.lazySingleton( () -> {
try
{
try
{
return new PrintWriter( createOrOpenAsOuputStream( fileSystem, reportFile, true ) );
} catch ( IOException e )
{
throw new RuntimeException( e );
}
return new PrintWriter( createOrOpenAsOuputStream( fileSystem, reportFile, true ) );
} catch ( IOException e )
{
throw new RuntimeException( e );
}
} ) );

Expand Down
Expand Up @@ -20,9 +20,9 @@
package org.neo4j.legacy.consistency;

import java.io.PrintWriter;
import java.util.function.Supplier;

import org.neo4j.function.Consumer;
import org.neo4j.function.Supplier;
import org.neo4j.function.Suppliers;
import org.neo4j.logging.AbstractLog;
import org.neo4j.logging.Log;
Expand Down
Expand Up @@ -20,8 +20,8 @@
package org.neo4j.legacy.consistency;

import java.io.PrintWriter;
import java.util.function.Supplier;

import org.neo4j.function.Supplier;
import org.neo4j.function.Suppliers;
import org.neo4j.logging.AbstractPrintWriterLogger;
import org.neo4j.logging.Logger;
Expand Down
Expand Up @@ -33,7 +33,6 @@
import org.neo4j.consistency.statistics.DefaultCounts;
import org.neo4j.consistency.statistics.Statistics;
import org.neo4j.consistency.statistics.VerboseStatistics;
import org.neo4j.function.Supplier;
import org.neo4j.function.Suppliers;
import org.neo4j.graphdb.factory.GraphDatabaseSettings;
import org.neo4j.kernel.configuration.Settings;
Expand Down Expand Up @@ -123,19 +122,14 @@ public Result runFullConsistencyCheck( final File storeDir, Config tuningConfigu

ConsistencySummaryStatistics summary;
final File reportFile = chooseReportPath( storeDir, tuningConfiguration );
Log reportLog = new ConsistencyReportLog( Suppliers.lazySingleton( new Supplier<PrintWriter>()
{
@Override
public PrintWriter get()
Log reportLog = new ConsistencyReportLog( Suppliers.lazySingleton( () -> {
try
{
try
{
return new PrintWriter( createOrOpenAsOuputStream( fileSystem, reportFile, true ) );
}
catch ( IOException e )
{
throw new RuntimeException( e );
}
return new PrintWriter( createOrOpenAsOuputStream( fileSystem, reportFile, true ) );
}
catch ( IOException e )
{
throw new RuntimeException( e );
}
} ) );

Expand Down
Expand Up @@ -19,16 +19,16 @@
*/
package org.neo4j.consistency;

import java.io.PrintWriter;
import java.util.function.Supplier;

import org.neo4j.function.Consumer;
import org.neo4j.function.Supplier;
import org.neo4j.function.Suppliers;
import org.neo4j.logging.AbstractLog;
import org.neo4j.logging.Log;
import org.neo4j.logging.Logger;
import org.neo4j.logging.NullLogger;

import java.io.PrintWriter;

public class ConsistencyReportLog extends AbstractLog
{
private final Supplier<PrintWriter> writerSupplier;
Expand Down
Expand Up @@ -19,13 +19,13 @@
*/
package org.neo4j.consistency;

import org.neo4j.function.Supplier;
import java.io.PrintWriter;
import java.util.function.Supplier;

import org.neo4j.function.Suppliers;
import org.neo4j.logging.AbstractPrintWriterLogger;
import org.neo4j.logging.Logger;

import java.io.PrintWriter;

public class ConsistencyReportLogger extends AbstractPrintWriterLogger
{
private final String prefix;
Expand Down
Expand Up @@ -20,12 +20,12 @@
package org.neo4j.cypher.internal.compiler.v3_0.executionplan;

import java.util.Map;
import java.util.function.Supplier;

import org.neo4j.cypher.internal.compiler.v3_0.ExecutionMode;
import org.neo4j.cypher.internal.compiler.v3_0.TaskCloser;
import org.neo4j.cypher.internal.compiler.v3_0.codegen.QueryExecutionTracer;
import org.neo4j.cypher.internal.compiler.v3_0.planDescription.InternalPlanDescription;
import org.neo4j.function.Supplier;
import org.neo4j.kernel.api.Statement;
import org.neo4j.kernel.impl.core.NodeManager;

Expand Down
Expand Up @@ -21,20 +21,20 @@ package org.neo4j.cypher.internal.compiler.v3_0.codegen

import java.lang.Boolean.getBoolean
import java.util
import java.util.function.Supplier

import org.neo4j.cypher.internal.compiler.v3_0.codegen.CodeGenerator.SourceSink
import org.neo4j.cypher.internal.compiler.v3_0.codegen.ir._
import org.neo4j.cypher.internal.compiler.v3_0.executionplan.{CompiledPlan, PlanFingerprint, _}
import org.neo4j.cypher.internal.compiler.v3_0.planDescription.InternalPlanDescription.Arguments.SourceCode
import org.neo4j.cypher.internal.compiler.v3_0.planDescription.{Id, InternalPlanDescription}
import org.neo4j.cypher.internal.compiler.v3_0.planner.CantCompileQueryException
import org.neo4j.cypher.internal.compiler.v3_0.planner.logical.plans._
import org.neo4j.cypher.internal.compiler.v3_0.planner.logical.{LogicalPlan2PlanDescription, LogicalPlanIdentificationBuilder}
import org.neo4j.cypher.internal.compiler.v3_0.planner.CantCompileQueryException
import org.neo4j.cypher.internal.compiler.v3_0.spi.{InstrumentedGraphStatistics, PlanContext}
import org.neo4j.cypher.internal.compiler.v3_0.{ExecutionMode, PlannerName, TaskCloser}
import org.neo4j.cypher.internal.frontend.v3_0.SemanticTable
import org.neo4j.cypher.internal.frontend.v3_0.helpers.Eagerly
import org.neo4j.function.Supplier
import org.neo4j.helpers.Clock
import org.neo4j.kernel.api.Statement
import org.neo4j.kernel.impl.core.NodeManager
Expand Down
Expand Up @@ -21,7 +21,7 @@ package org.neo4j.cypher.internal.compiler.v3_0.executionplan

import java.io.{PrintWriter, StringWriter}
import java.util
import java.util.Collections
import java.util.function.Supplier

import org.neo4j.cypher.internal.compiler.v3_0._
import org.neo4j.cypher.internal.compiler.v3_0.commands.values.KeyToken
Expand All @@ -32,7 +32,6 @@ import org.neo4j.cypher.internal.compiler.v3_0.planDescription.InternalPlanDescr
import org.neo4j.cypher.internal.frontend.v3_0.helpers.Eagerly
import org.neo4j.cypher.internal.frontend.v3_0.notification.InternalNotification
import org.neo4j.cypher.internal.frontend.v3_0.{EntityNotFoundException, ProfilerStatisticsNotReadyException}
import org.neo4j.function.Supplier
import org.neo4j.graphdb.QueryExecutionType._
import org.neo4j.graphdb.Result.{ResultRow, ResultVisitor}
import org.neo4j.graphdb._
Expand Down
Expand Up @@ -19,6 +19,8 @@
*/
package org.neo4j.cypher.internal.compiler.v3_0.executionplan

import java.util.function.Supplier

import org.neo4j.cypher.internal.compiler.v3_0.codegen.QueryExecutionTracer
import org.neo4j.cypher.internal.compiler.v3_0.codegen.profiling.ProfilingTracer
import org.neo4j.cypher.internal.compiler.v3_0.commands._
Expand All @@ -27,17 +29,15 @@ import org.neo4j.cypher.internal.compiler.v3_0.executionplan.builders._
import org.neo4j.cypher.internal.compiler.v3_0.pipes._
import org.neo4j.cypher.internal.compiler.v3_0.planDescription.InternalPlanDescription
import org.neo4j.cypher.internal.compiler.v3_0.planDescription.InternalPlanDescription.Arguments
import org.neo4j.cypher.internal.compiler.v3_0.planner.logical.Cardinality
import org.neo4j.cypher.internal.compiler.v3_0.planner.logical.plans.LogicalPlan
import org.neo4j.cypher.internal.compiler.v3_0.planner.{CantCompileQueryException, CantHandleQueryException}
import org.neo4j.cypher.internal.compiler.v3_0.profiler.Profiler
import org.neo4j.cypher.internal.compiler.v3_0.spi._
import org.neo4j.cypher.internal.compiler.v3_0.symbols.SymbolTable
import org.neo4j.cypher.internal.compiler.v3_0.{ExecutionMode, ProfileMode, _}
import org.neo4j.cypher.internal.frontend.v3_0.{LabelId, PeriodicCommitInOpenTransactionException}
import org.neo4j.cypher.internal.frontend.v3_0.PeriodicCommitInOpenTransactionException
import org.neo4j.cypher.internal.frontend.v3_0.ast.Statement
import org.neo4j.cypher.internal.frontend.v3_0.notification.{LargeLabelWithLoadCsvNotification, EagerLoadCsvNotification, InternalNotification}
import org.neo4j.function.Supplier
import org.neo4j.cypher.internal.frontend.v3_0.notification.InternalNotification
import org.neo4j.function.Suppliers.singleton
import org.neo4j.graphdb.GraphDatabaseService
import org.neo4j.graphdb.QueryExecutionType.QueryType
Expand Down
Expand Up @@ -21,6 +21,7 @@
package org.neo4j.cypher.internal.spi.v2_3

import java.util
import java.util.function.Supplier

import org.neo4j.codegen
import org.neo4j.codegen.CodeGeneratorOption._
Expand All @@ -42,7 +43,6 @@ import org.neo4j.cypher.internal.compiler.v2_3.planner.CantCompileQueryException
import org.neo4j.cypher.internal.compiler.v2_3.{ExecutionMode, TaskCloser}
import org.neo4j.cypher.internal.frontend.v2_3.symbols.CypherType
import org.neo4j.cypher.internal.frontend.v2_3.{SemanticDirection, CypherExecutionException, ParameterNotFoundException, symbols}
import org.neo4j.function.Supplier
import org.neo4j.graphdb.{Relationship, Node, Direction}
import org.neo4j.graphdb.Result.{ResultRow, ResultVisitor}
import org.neo4j.helpers.collection.MapUtil
Expand Down
Expand Up @@ -21,6 +21,7 @@
package org.neo4j.cypher.internal.spi.v3_0

import java.util
import java.util.function.Supplier

import org.neo4j.codegen
import org.neo4j.codegen.CodeGeneratorOption._
Expand All @@ -42,7 +43,6 @@ import org.neo4j.cypher.internal.compiler.v3_0.planner.CantCompileQueryException
import org.neo4j.cypher.internal.compiler.v3_0.{ExecutionMode, TaskCloser}
import org.neo4j.cypher.internal.frontend.v3_0.symbols.CypherType
import org.neo4j.cypher.internal.frontend.v3_0.{CypherExecutionException, ParameterNotFoundException, SemanticDirection, symbols}
import org.neo4j.function.Supplier
import org.neo4j.graphdb.Result.{ResultRow, ResultVisitor}
import org.neo4j.graphdb.{Direction, Node, Relationship}
import org.neo4j.helpers.collection.MapUtil
Expand Down
Expand Up @@ -20,6 +20,7 @@
package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir

import java.util.concurrent.atomic.AtomicInteger
import java.util.function.Supplier

import org.mockito.Mockito._
import org.neo4j.cypher.internal.compiler.v3_0.codegen.{Namer, _}
Expand All @@ -31,7 +32,6 @@ import org.neo4j.cypher.internal.compiler.v3_0.spi.{GraphStatistics, PlanContext
import org.neo4j.cypher.internal.compiler.v3_0.{CostBasedPlannerName, ExecutionMode, NormalMode, TaskCloser}
import org.neo4j.cypher.internal.frontend.v3_0.SemanticTable
import org.neo4j.cypher.internal.spi.v3_0.GeneratedQueryStructure
import org.neo4j.function.Supplier
import org.neo4j.graphdb.GraphDatabaseService
import org.neo4j.graphdb.Result.{ResultRow, ResultVisitor}
import org.neo4j.helpers.Clock
Expand Down
Expand Up @@ -19,6 +19,8 @@
*/
package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir

import java.util.function.Supplier

import org.mockito.Matchers._
import org.mockito.Mockito._
import org.neo4j.collection.primitive.PrimitiveLongIterator
Expand All @@ -33,11 +35,10 @@ import org.neo4j.cypher.internal.compiler.v3_0.planner.{CardinalityEstimation, P
import org.neo4j.cypher.internal.frontend.v3_0.ast.SignedDecimalIntegerLiteral
import org.neo4j.cypher.internal.frontend.v3_0.symbols
import org.neo4j.cypher.internal.frontend.v3_0.test_helpers.CypherFunSuite
import org.neo4j.function.Supplier
import org.neo4j.kernel.GraphDatabaseAPI
import org.neo4j.kernel.api._
import org.neo4j.kernel.impl.core.{NodeManager, NodeProxy}
import org.neo4j.test.{TestGraphDatabaseFactory, ImpermanentGraphDatabase}
import org.neo4j.test.TestGraphDatabaseFactory

class CompiledProfilingTest extends CypherFunSuite with CodeGenSugar {

Expand Down
Expand Up @@ -20,6 +20,7 @@
package org.neo4j.function;

import java.util.Map;
import java.util.function.Supplier;

/**
* Constructors for basic {@link Function} and {@link BiFunction} types
Expand Down Expand Up @@ -197,36 +198,4 @@ public T apply( Void t )
}
};
}

/**
* @deprecated use {@link Consumers#noop()}
* @param <TYPE> the type of object to swallow
* @param type the type to swallow
* @return return the consumer of the type object
*/
@Deprecated
@SuppressWarnings( "unchecked" )
public static <TYPE> Consumer<TYPE> swallow( @SuppressWarnings( "UnusedParameters" ) Class<TYPE> type )
{
return Consumers.noop();
}

/**
* @deprecated use {@link Suppliers#singleton(Object)}
* @param <T> the type of the item object
* @param item the constant item
* @return return a factory object
*/
@Deprecated
public static <T> Factory<T> constantly( final T item )
{
return new Factory<T>()
{
@Override
public T newInstance()
{
return item;
}
};
}
}
Expand Up @@ -24,6 +24,8 @@
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.function.BooleanSupplier;
import java.util.function.Supplier;

/**
* Constructors for basic {@link Predicate} types
Expand Down Expand Up @@ -221,12 +223,12 @@ public static void await( Supplier<Boolean> condition, long timeout, TimeUnit un
}


public static void awaitForever( Supplier<Boolean> condition, long checkInterval, TimeUnit unit ) throws InterruptedException
public static void awaitForever( BooleanSupplier condition, long checkInterval, TimeUnit unit ) throws InterruptedException
{
long sleep = unit.toMillis( checkInterval );
do
{
if ( condition.get() )
if ( condition.getAsBoolean() )
{
return;
}
Expand Down
36 changes: 0 additions & 36 deletions community/function/src/main/java/org/neo4j/function/Supplier.java

This file was deleted.

0 comments on commit d3ccb94

Please sign in to comment.