package org.tizen.common.builder.dependency;
import java.io.File;
-import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
-import java.util.List;
import java.util.Set;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import static org.slf4j.LoggerFactory.*;
import org.tizen.common.builder.BuildDependency;
import org.tizen.common.builder.BuildProcess;
import org.tizen.common.builder.Dependency;
import org.tizen.common.util.Assert;
import org.tizen.common.util.StringUtil;
+import com.orientechnologies.orient.core.config.OGlobalConfiguration;
import com.tinkerpop.blueprints.Direction;
import com.tinkerpop.blueprints.Edge;
import com.tinkerpop.blueprints.Vertex;
public class DependencyInDB implements BuildDependency {
- protected static final Logger logger = LoggerFactory.getLogger( DependencyInDB.class );
+ protected static final Logger logger = getLogger( DependencyInDB.class );
public static final String DB_NAME = "Dependency";
bCreateIndex = true;
}
+ // Bug fixed:
+ // this is a solution of OConcurrentModificationException problem.
+ // but, this patch affects a performance.
+ OGlobalConfiguration.CACHE_LEVEL1_ENABLED.setValue( false );
+
// create or open DB
graph = new OrientGraphNoTx( url );
graph.setUseLightweightEdges( false );
// remove database from local storage.
// INFO: Gremlin actually deletes all the edges for you if you delete the vertex.
Iterator<Vertex> vIter = graph.getVertices( DependencyConstant.RESOURCE_KEY_PROJECT, this.projectName ).iterator();
- List<Vertex> list = new ArrayList<Vertex>();
while ( vIter.hasNext() ) {
- list.add( vIter.next() );
- }
- for ( Vertex v : list ) {
- v.remove();
+ vIter.next().remove();
}
logger.trace( "Remove all resources" );
Assert.notNull( outVertex );
OrientEdge edge = graph.addEdge( null, outVertex, inVertex, DependencyConstant.EDGE_LABEL );
- edge.save();
logger.trace( "an added edge : {}", edge );
}
// remove edges
Iterator<Edge> iterator = inVertex.getEdges( outVertex, Direction.IN ).iterator();
- List<Edge> edges = new ArrayList<Edge>();
while( iterator.hasNext() ) {
- edges.add( iterator.next() );
- }
- for ( Edge edge : edges ) {
- logger.trace( "an removed edge : {}", edge );
+ Edge edge = iterator.next();
edge.remove();
+ logger.trace( "an removed edge : {}", edge );
}
}
}