-
Notifications
You must be signed in to change notification settings - Fork 515
/
HugeVertex.java
722 lines (646 loc) · 25.1 KB
/
HugeVertex.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.apache.hugegraph.structure;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import org.apache.commons.collections.CollectionUtils;
import org.apache.hugegraph.HugeException;
import org.apache.hugegraph.HugeGraph;
import org.apache.hugegraph.backend.id.Id;
import org.apache.hugegraph.backend.id.IdGenerator;
import org.apache.hugegraph.backend.id.SnowflakeIdGenerator;
import org.apache.hugegraph.backend.id.SplicingIdGenerator;
import org.apache.hugegraph.backend.query.ConditionQuery;
import org.apache.hugegraph.backend.query.Query;
import org.apache.hugegraph.backend.query.QueryResults;
import org.apache.hugegraph.backend.serializer.BytesBuffer;
import org.apache.hugegraph.backend.tx.GraphTransaction;
import org.apache.hugegraph.config.CoreOptions;
import org.apache.hugegraph.masterelection.StandardClusterRoleStore;
import org.apache.hugegraph.perf.PerfUtil.Watched;
import org.apache.hugegraph.schema.EdgeLabel;
import org.apache.hugegraph.schema.PropertyKey;
import org.apache.hugegraph.schema.VertexLabel;
import org.apache.hugegraph.task.HugeServerInfo;
import org.apache.hugegraph.task.HugeTask;
import org.apache.hugegraph.task.HugeTaskResult;
import org.apache.hugegraph.type.HugeType;
import org.apache.hugegraph.type.define.Cardinality;
import org.apache.hugegraph.type.define.CollectionType;
import org.apache.hugegraph.type.define.Directions;
import org.apache.hugegraph.type.define.HugeKeys;
import org.apache.hugegraph.type.define.IdStrategy;
import org.apache.hugegraph.util.E;
import org.apache.hugegraph.util.collection.CollectionFactory;
import org.apache.logging.log4j.util.Strings;
import org.apache.tinkerpop.gremlin.structure.Direction;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.T;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.apache.tinkerpop.gremlin.structure.VertexProperty;
import org.apache.tinkerpop.gremlin.structure.util.ElementHelper;
import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyVertexProperty;
import com.google.common.collect.ImmutableList;
public class HugeVertex extends HugeElement implements Vertex, Cloneable {
private static final List<HugeEdge> EMPTY_LIST = ImmutableList.of();
private Id id;
private VertexLabel label;
protected Collection<HugeEdge> edges;
public HugeVertex(final HugeGraph graph, Id id, VertexLabel label) {
super(graph);
E.checkArgumentNotNull(label, "Vertex label can't be null");
this.label = label;
this.id = id;
this.edges = EMPTY_LIST;
if (this.id != null) {
if (label.idStrategy() == IdStrategy.CUSTOMIZE_UUID) {
this.assignId(id);
} else {
this.checkIdLength();
}
}
}
@Override
public HugeType type() {
if (label != null &&
(label.name().equals(HugeTask.P.TASK) ||
label.name().equals(HugeTaskResult.P.TASKRESULT))) {
return HugeType.TASK;
}
if (label != null &&
(label.name().equals(HugeServerInfo.P.SERVER) ||
label.name().equals(StandardClusterRoleStore.P.ROLE_DATA))) {
return HugeType.SERVER;
}
return HugeType.VERTEX;
}
@Override
public Id id() {
return this.id;
}
@Override
public VertexLabel schemaLabel() {
assert VertexLabel.OLAP_VL.equals(this.label) ||
this.graph().sameAs(this.label.graph());
return this.label;
}
@Override
public String name() {
E.checkState(this.label.idStrategy() == IdStrategy.PRIMARY_KEY,
"Only primary key vertex has name, " +
"but got '%s' with id strategy '%s'",
this, this.label.idStrategy());
String name;
if (this.id != null) {
String[] parts = SplicingIdGenerator.parse(this.id);
E.checkState(parts.length == 2,
"Invalid primary key vertex id '%s'", this.id);
name = parts[1];
} else {
assert this.id == null;
List<Object> propValues = this.primaryValues();
E.checkState(!propValues.isEmpty(),
"Primary values must not be empty " +
"(has properties %s)", hasProperties());
name = ConditionQuery.concatValues(propValues);
E.checkArgument(!name.isEmpty(),
"The value of primary key can't be empty");
}
return name;
}
public void assignId(Id id) {
this.assignId(id, false);
}
@Watched(prefix = "vertex")
public void assignId(Id id, boolean force) {
IdStrategy strategy = this.label.idStrategy();
// Generate an id and assign
switch (strategy) {
case CUSTOMIZE_STRING:
assert !id.number();
this.id = id;
break;
case CUSTOMIZE_NUMBER:
assert id.number();
this.id = id;
break;
case CUSTOMIZE_UUID:
this.id = id.uuid() ? id : IdGenerator.of(id.asString(), true);
break;
case PRIMARY_KEY:
this.id = SplicingIdGenerator.instance().generate(this);
break;
case AUTOMATIC:
if (force) {
// Resume id for AUTOMATIC id strategy in restoring mode
assert id.number();
this.id = id;
} else {
this.id = SnowflakeIdGenerator.instance(this.graph())
.generate(this);
}
break;
default:
throw new AssertionError(String.format("Unknown id strategy '%s'", strategy));
}
this.checkIdLength();
}
protected void checkIdLength() {
assert this.id != null;
int len = this.id.asBytes().length;
if (len <= BytesBuffer.ID_LEN_MAX) {
return;
}
E.checkArgument(false,
"The max length of vertex id is %s, but got %s {%s}",
BytesBuffer.ID_LEN_MAX, len, this.id);
}
@Override
public String label() {
return this.schemaLabel().name();
}
public void correctVertexLabel(VertexLabel correctLabel) {
E.checkArgumentNotNull(correctLabel, "Vertex label can't be null");
if (this.label != null && !this.label.undefined() &&
!correctLabel.undefined()) {
E.checkArgument(this.label.equals(correctLabel),
"Vertex label can't be changed from '%s' to '%s'",
this.label, correctLabel);
}
this.label = correctLabel;
}
@Watched(prefix = "vertex")
protected List<Object> primaryValues() {
E.checkArgument(this.label.idStrategy() == IdStrategy.PRIMARY_KEY,
"The id strategy '%s' don't have primary keys",
this.label.idStrategy());
List<Id> primaryKeys = this.label.primaryKeys();
E.checkArgument(!primaryKeys.isEmpty(),
"Primary key can't be empty for id strategy '%s'",
IdStrategy.PRIMARY_KEY);
boolean encodeNumber = this.graph()
.option(CoreOptions.VERTEX_ENCODE_PK_NUMBER);
List<Object> propValues = new ArrayList<>(primaryKeys.size());
for (Id pk : primaryKeys) {
HugeProperty<?> property = this.getProperty(pk);
E.checkState(property != null,
"The value of primary key '%s' can't be null",
this.graph().propertyKey(pk).name());
Object propValue = property.serialValue(encodeNumber);
if (Strings.EMPTY.equals(propValue)) {
propValue = ConditionQuery.INDEX_VALUE_EMPTY;
}
propValues.add(propValue);
}
return propValues;
}
public boolean existsEdges() {
return !this.edges.isEmpty();
}
public Collection<HugeEdge> getEdges() {
return Collections.unmodifiableCollection(this.edges);
}
public void resetEdges() {
/*
* Use List to hold edges to reduce memory usage and operation time.
*/
this.edges = newList();
}
public void removeEdge(HugeEdge edge) {
this.edges.remove(edge);
}
public void addEdge(HugeEdge edge) {
if (this.edges == EMPTY_LIST) {
this.edges = newList();
}
this.edges.add(edge);
}
/**
* Add one edge between this vertex and other vertex
* <p>
* *** this method is not thread safe, must clone this vertex first before
* multi thread access e.g. `vertex.copy().resetTx();` ***
*/
@Watched(prefix = "vertex")
@Override
public HugeEdge addEdge(String label, Vertex vertex, Object... keyValues) {
HugeVertex targetVertex = (HugeVertex) vertex;
HugeEdge edge = this.constructEdge(label, targetVertex, keyValues);
// Attach edge to vertex
this.addOutEdge(edge);
targetVertex.addInEdge(edge.switchOwner());
if (this.fresh()) {
this.graph().canAddEdge(edge);
return this.tx().addEdge(edge);
} else {
return (HugeEdge) this.graph().addEdge(edge);
}
}
public HugeEdge constructEdge(String label, HugeVertex vertex,
Object... keyValues) {
ElementKeys elemKeys = classifyKeys(keyValues);
// Check id (must be null)
if (elemKeys.id() != null) {
throw Edge.Exceptions.userSuppliedIdsNotSupported();
}
Id id = null;
// Check target vertex
E.checkArgumentNotNull(vertex, "Target vertex can't be null");
// Check label
E.checkArgument(label != null && !label.isEmpty(),
"Edge label can't be null or empty");
EdgeLabel edgeLabel = this.graph().edgeLabel(label);
// Check link
E.checkArgument(edgeLabel.checkLinkEqual(this.schemaLabel().id(),
vertex.schemaLabel().id()),
"Undefined link of edge label '%s': '%s' -> '%s'",
label, this.label(), vertex.label());
// Check sortKeys
List<Id> keys = this.graph().mapPkName2Id(elemKeys.keys());
E.checkArgument(new HashSet<>(keys).containsAll(edgeLabel.sortKeys()),
"The sort key(s) must be set for the edge " +
"with label: '%s'", edgeLabel.name());
// Check whether passed all non-null props
@SuppressWarnings("unchecked")
Collection<Id> nonNullKeys = CollectionUtils.subtract(
edgeLabel.properties(),
edgeLabel.nullableKeys());
if (!new HashSet<>(keys).containsAll(nonNullKeys)) {
@SuppressWarnings("unchecked")
Collection<Id> missed = CollectionUtils.subtract(nonNullKeys, keys);
E.checkArgument(false, "All non-null property keys: %s " +
"of edge label '%s' must be set, " +
"but missed keys: %s",
this.graph().mapPkId2Name(nonNullKeys),
edgeLabel.name(),
this.graph().mapPkId2Name(missed));
}
HugeEdge edge = new HugeEdge(this, id, edgeLabel, vertex);
// Set properties
ElementHelper.attachProperties(edge, keyValues);
edge.assignId();
return edge;
}
/**
* Add edge with direction OUT
*
* @param edge the out edge
*/
@Watched
public void addOutEdge(HugeEdge edge) {
if (edge.ownerVertex() == null) {
edge.sourceVertex(this);
}
E.checkState(edge.isDirection(Directions.OUT),
"The owner vertex('%s') of OUT edge '%s' should be '%s'",
edge.ownerVertex().id(), edge, this.id());
this.addEdge(edge);
}
/**
* Add edge with direction IN
*
* @param edge the in edge
*/
@Watched
public void addInEdge(HugeEdge edge) {
if (edge.ownerVertex() == null) {
edge.targetVertex(this);
}
E.checkState(edge.isDirection(Directions.IN),
"The owner vertex('%s') of IN edge '%s' should be '%s'",
edge.ownerVertex().id(), edge, this.id());
this.addEdge(edge);
}
public Iterator<Edge> getEdges(Directions direction, String... edgeLabels) {
List<Edge> list = new LinkedList<>();
for (HugeEdge edge : this.edges) {
if (edge.matchDirection(direction) &&
edge.belongToLabels(edgeLabels)) {
list.add(edge);
}
}
return list.iterator();
}
public Iterator<Vertex> getVertices(Directions direction,
String... edgeLabels) {
List<Vertex> list = new LinkedList<>();
Iterator<Edge> edges = this.getEdges(direction, edgeLabels);
while (edges.hasNext()) {
HugeEdge edge = (HugeEdge) edges.next();
list.add(edge.otherVertex(this));
}
return list.iterator();
}
@Watched(prefix = "vertex")
@Override
public Iterator<Edge> edges(Direction tinkerpopDir, String... edgeLabels) {
Directions direction = Directions.convert(tinkerpopDir);
Id[] edgeLabelIds = this.graph().mapElName2Id(edgeLabels);
Query query = GraphTransaction.constructEdgesQuery(this.id(), direction,
edgeLabelIds);
return this.graph().edges(query);
}
@Watched(prefix = "vertex")
@Override
public Iterator<Vertex> vertices(Direction direction,
String... edgeLabels) {
Iterator<Edge> edges = this.edges(direction, edgeLabels);
return this.graph().adjacentVertices(edges);
}
@Watched(prefix = "vertex")
@Override
public void remove() {
this.removed(true);
/*
* Call by tx or by graph to remove vertex,
* call by tx if the vertex is new because the context is dependent
*/
GraphTransaction tx = this.tx();
if (tx != null) {
assert this.fresh();
tx.removeVertex(this);
} else {
assert !this.fresh();
this.graph().removeVertex(this);
}
}
@Watched(prefix = "vertex")
@Override
public <V> VertexProperty<V> property(VertexProperty.Cardinality cardinality,
String key, V value, Object... objects) {
if (objects.length != 0 && objects[0].equals(T.id)) {
throw VertexProperty.Exceptions.userSuppliedIdsNotSupported();
}
// TODO: extra props: objects
if (objects.length != 0) {
throw VertexProperty.Exceptions.metaPropertiesNotSupported();
}
PropertyKey propertyKey = this.graph().propertyKey(key);
/*
* g.AddV("xxx").property("key1", val1).property("key2", val2)
* g.AddV("xxx").property(single, "key1", val1)
* .property(list, "key2", val2)
*
* The cardinality single may be user supplied single, it may also be
* that user doesn't supply cardinality, when it is latter situation,
* we shouldn't check it. Because of this reason, we are forced to
* give up the check of user supplied cardinality single.
* The cardinality not single must be user supplied, so should check it
*/
if (cardinality != VertexProperty.Cardinality.single) {
E.checkArgument(propertyKey.cardinality() ==
Cardinality.convert(cardinality),
"Invalid cardinality '%s' for property key '%s', " +
"expect '%s'", cardinality, key,
propertyKey.cardinality().string());
}
// Check key in vertex label
E.checkArgument(VertexLabel.OLAP_VL.equals(this.label) ||
this.label.properties().contains(propertyKey.id()),
"Invalid property '%s' for vertex label '%s'",
key, this.label);
// Primary-Keys can only be set once
if (this.schemaLabel().primaryKeys().contains(propertyKey.id())) {
E.checkArgument(!this.hasProperty(propertyKey.id()),
"Can't update primary key: '%s'", key);
}
if (value == null) {
this.removeProperty(propertyKey.id());
return EmptyVertexProperty.instance();
}
@SuppressWarnings("unchecked")
VertexProperty<V> prop = (VertexProperty<V>) this.addProperty(propertyKey,
value, !this.fresh());
return prop;
}
@Override
protected GraphTransaction tx() {
return null;
}
@Watched(prefix = "vertex")
@Override
protected <V> HugeVertexProperty<V> newProperty(PropertyKey pkey, V val) {
return new HugeVertexProperty<>(this, pkey, val);
}
@Watched(prefix = "vertex")
@Override
protected <V> void onUpdateProperty(Cardinality cardinality,
HugeProperty<V> prop) {
if (prop != null) {
assert prop instanceof HugeVertexProperty;
/*
* Call tx or graph to update property,
* call by tx if the vertex is new because the context is dependent
* (should update cache even if it's new)
*/
GraphTransaction tx = this.tx();
if (tx != null) {
assert this.fresh();
tx.addVertexProperty((HugeVertexProperty<V>) prop);
} else {
assert !this.fresh();
this.graph().addVertexProperty((HugeVertexProperty<V>) prop);
}
}
}
@Watched(prefix = "vertex")
@Override
protected boolean ensureFilledProperties(boolean throwIfNotExist) {
if (this.isPropLoaded()) {
this.updateToDefaultValueIfNone();
return true;
}
// Skip query if there is no any property key in schema
if (this.schemaLabel().properties().isEmpty()) {
this.propLoaded();
return true;
}
// NOTE: only adjacent vertex will reach here
Iterator<Vertex> vertices = this.graph().adjacentVertex(this.id());
HugeVertex vertex = (HugeVertex) QueryResults.one(vertices);
if (vertex == null && !throwIfNotExist) {
return false;
}
E.checkState(vertex != null, "Vertex '%s' does not exist", this.id);
if (vertex.schemaLabel().undefined() ||
!vertex.schemaLabel().equals(this.schemaLabel())) {
// Update vertex label of dangling edge to undefined
this.correctVertexLabel(VertexLabel.undefined(this.graph()));
vertex.resetProperties();
}
this.copyProperties(vertex);
this.updateToDefaultValueIfNone();
return true;
}
@Watched(prefix = "vertex")
@SuppressWarnings("unchecked") // (VertexProperty<V>) prop
@Override
public <V> Iterator<VertexProperty<V>> properties(String... keys) {
// TODO: Compatible with TinkerPop properties() (HugeGraph-742)
this.ensureFilledProperties(true);
// Capacity should be about the following size
int propsCapacity = keys.length == 0 ?
this.sizeOfProperties() :
keys.length;
List<VertexProperty<V>> props = new ArrayList<>(propsCapacity);
if (keys.length == 0) {
for (HugeProperty<?> prop : this.getProperties()) {
assert prop instanceof VertexProperty;
props.add((VertexProperty<V>) prop);
}
} else {
for (String key : keys) {
Id pkeyId;
try {
pkeyId = this.graph().propertyKey(key).id();
} catch (IllegalArgumentException ignored) {
continue;
}
HugeProperty<?> prop = this.getProperty(pkeyId);
if (prop == null) {
// Not found
continue;
}
assert prop instanceof VertexProperty;
props.add((VertexProperty<V>) prop);
}
}
return props.iterator();
}
@Override
public Object sysprop(HugeKeys key) {
switch (key) {
case ID:
return this.id();
case LABEL:
return this.schemaLabel().id();
case PRIMARY_VALUES:
return this.name();
case PROPERTIES:
return this.getPropertiesMap();
default:
E.checkArgument(false,
"Invalid system property '%s' of Vertex", key);
return null;
}
}
public boolean valid() {
try {
return this.ensureFilledProperties(false);
} catch (Throwable e) {
// Generally the program can't get here
return false;
}
}
/**
* Clear edges/properties of the cloned vertex, and set `removed` true
*
* @return a new vertex
*/
public HugeVertex prepareRemoved() {
// NOTE: clear edges/properties of the cloned vertex and return
HugeVertex vertex = this.clone();
// Remove self
vertex.removed(true);
vertex.resetEdges();
vertex.resetProperties();
return vertex;
}
public boolean olap() {
return this.label.olap();
}
@Override
public HugeVertex copy() {
HugeVertex vertex = this.clone();
vertex.copyProperties(this);
return vertex;
}
@Override
protected HugeVertex clone() {
try {
return (HugeVertex) super.clone();
} catch (CloneNotSupportedException e) {
throw new HugeException("Failed to clone HugeVertex", e);
}
}
@Override
public String toString() {
return StringFactory.vertexString(this);
}
public static final Id getIdValue(Object idValue) {
return HugeElement.getIdValue(idValue);
}
public static HugeVertex undefined(HugeGraph graph, Id id) {
VertexLabel label = VertexLabel.undefined(graph);
return new HugeVertex(graph, id, label);
}
public static HugeVertex create(final GraphTransaction tx,
Id id, VertexLabel label) {
return new HugeVertex4Insert(tx, id, label);
}
private static <V> Set<V> newSet() {
return CollectionFactory.newSet(CollectionType.EC);
}
private static <V> List<V> newList() {
return CollectionFactory.newList(CollectionType.EC);
}
private static final class HugeVertex4Insert extends HugeVertex {
private GraphTransaction tx;
public HugeVertex4Insert(final GraphTransaction tx,
Id id, VertexLabel label) {
super(tx.graph(), id, label);
/*
* Use Set to hold edges inserted into vertex
* to avoid duplicated edges
*/
this.edges = newSet();
this.tx = tx;
this.fresh(true);
}
@Override
public void resetEdges() {
this.edges = newSet();
}
@Override
public void addEdge(HugeEdge edge) {
if (this.edges == EMPTY_LIST) {
this.edges = newSet();
}
this.edges.add(edge);
}
@Override
public void committed() {
super.committed();
this.tx = null;
}
@Override
protected GraphTransaction tx() {
if (this.fresh()) {
E.checkNotNull(this.tx, "tx");
return this.tx;
}
return null;
}
}
}