Skip to content

Commit

Permalink
Fix the circular initialization dependency
Browse files Browse the repository at this point in the history
ModifierType and TypeDefinitionCategory has circular initialization dependency,
as a result, if we access ModifierType before TypeDefinitionCategory, it will
cause java.lang.ExceptionInInitializerError problem.

Signed-off-by: Hongjiang Zhang <timerzhj@hotmail.com>
Signed-off-by: Oleksandr Porunov <alexandr.porunov@gmail.com>
  • Loading branch information
ministat authored and porunov committed Sep 27, 2024
1 parent 4cec993 commit c6107eb
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@
* @author Joshua Shinavier (http://fortytwo.net)
*/
public enum ModifierType {
CONSISTENCY(TypeDefinitionCategory.CONSISTENCY_LEVEL),
TTL(TypeDefinitionCategory.TTL);
CONSISTENCY,
TTL;

private final TypeDefinitionCategory category;
private TypeDefinitionCategory category;

ModifierType(final TypeDefinitionCategory category) {
this.category = category;
static {
CONSISTENCY.category = TypeDefinitionCategory.CONSISTENCY_LEVEL;
TTL.category = TypeDefinitionCategory.TTL;
}

public TypeDefinitionCategory getCategory() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Copyright 2024 JanusGraph Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package org.janusgraph.graphdb;

import org.janusgraph.graphdb.database.management.ModifierType;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.fail;

public class TestModifierType {
// Verify whether the circular initialization dependency was resolved for ModifierType and TypeDefinitionCategory
@Test
public void testLoadModifierType() {
try {
ModifierType m = ModifierType.CONSISTENCY;
assert(m != null);
} catch (Exception | Error e) {
fail("Fail to access ModifierType");
}
}
}

1 comment on commit c6107eb

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: c6107eb Previous: 73232fe Ratio
org.janusgraph.JanusGraphSpeedBenchmark.basicAddAndDelete 12295.156941339628 ms/op 12548.841765768664 ms/op 0.98
org.janusgraph.GraphCentricQueryBenchmark.getVertices 903.5802897012413 ms/op 908.9160965066542 ms/op 0.99
org.janusgraph.MgmtOlapJobBenchmark.runClearIndex 216.33660728224635 ms/op 215.56932801666667 ms/op 1.00
org.janusgraph.MgmtOlapJobBenchmark.runReindex 319.964782675 ms/op 322.9509254536765 ms/op 0.99
org.janusgraph.JanusGraphSpeedBenchmark.basicCount 222.01878575112306 ms/op 212.78665196498793 ms/op 1.04
org.janusgraph.CQLMultiQueryMultiSlicesBenchmark.getValuesAllPropertiesWithAllMultiQuerySlicesUnderMaxRequestsPerConnection 4632.917002772849 ms/op 4698.239144101103 ms/op 0.99
org.janusgraph.CQLMultiQueryBenchmark.getElementsWithUsingEmitRepeatSteps 15829.243578562615 ms/op 15966.206554570066 ms/op 0.99
org.janusgraph.CQLMultiQueryMultiSlicesBenchmark.getValuesMultiplePropertiesWithSmallBatch 18619.692658172728 ms/op 19081.16261119033 ms/op 0.98
org.janusgraph.CQLMultiQueryMultiSlicesBenchmark.vertexCentricPropertiesFetching 56960.12680766666 ms/op 55375.80740896666 ms/op 1.03
org.janusgraph.CQLMultiQueryBenchmark.getAllElementsTraversedFromOuterVertex 7700.384339122431 ms/op 7708.374268012084 ms/op 1.00
org.janusgraph.CQLMultiQueryBenchmark.getVerticesWithDoubleUnion 389.200313735011 ms/op 381.9027326485772 ms/op 1.02
org.janusgraph.CQLMultiQueryMultiSlicesBenchmark.getValuesAllPropertiesWithUnlimitedBatch 3897.7539913294536 ms/op 3899.8398211893646 ms/op 1.00
org.janusgraph.CQLMultiQueryBenchmark.getNames 7792.019788588782 ms/op 7815.098555887045 ms/op 1.00
org.janusgraph.CQLMultiQueryMultiSlicesBenchmark.getValuesThreePropertiesWithAllMultiQuerySlicesUnderMaxRequestsPerConnection 5583.0753742424995 ms/op 5666.585976946075 ms/op 0.99
org.janusgraph.CQLMultiQueryBenchmark.getLabels 6688.495842699634 ms/op 6658.275468181763 ms/op 1.00
org.janusgraph.CQLMultiQueryBenchmark.getVerticesFilteredByAndStep 435.6212790902633 ms/op 428.13637674948495 ms/op 1.02
org.janusgraph.CQLMultiQueryBenchmark.getVerticesFromMultiNestedRepeatStepStartingFromSingleVertex 12466.50983828627 ms/op 12269.209682924633 ms/op 1.02
org.janusgraph.CQLMultiQueryBenchmark.getVerticesWithCoalesceUsage 361.9563685191202 ms/op 360.9079409445181 ms/op 1.00
org.janusgraph.CQLMultiQueryMultiSlicesBenchmark.getValuesMultiplePropertiesWithAllMultiQuerySlicesUnderMaxRequestsPerConnection 13282.331091806089 ms/op 13979.482008851768 ms/op 0.95
org.janusgraph.CQLMultiQueryBenchmark.getIdToOutVerticesProjection 248.60737930444378 ms/op 246.77816763466674 ms/op 1.01
org.janusgraph.CQLMultiQueryMultiSlicesBenchmark.getValuesMultiplePropertiesWithUnlimitedBatch 13656.281012292666 ms/op 14415.369742636307 ms/op 0.95
org.janusgraph.CQLMultiQueryBenchmark.getNeighborNames 7746.402406432287 ms/op 7710.845519076539 ms/op 1.00
org.janusgraph.CQLMultiQueryBenchmark.getElementsWithUsingRepeatUntilSteps 8462.58426607407 ms/op 8551.481096059784 ms/op 0.99
org.janusgraph.CQLMultiQueryBenchmark.getAdjacentVerticesLocalCounts 8010.610553759605 ms/op 8050.205522232533 ms/op 1.00

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.