11
11
@ SuppressWarnings ("all" )
12
12
public final class FrameCodecDecoder
13
13
{
14
- private static final boolean DEBUG_MODE = !Boolean .getBoolean ("agrona.disable.bounds.checks" );
14
+ private static final boolean ENABLE_BOUNDS_CHECKS = !Boolean .getBoolean ("agrona.disable.bounds.checks" );
15
+
16
+ private static final boolean ENABLE_ACCESS_ORDER_CHECKS = Boolean .parseBoolean (System .getProperty (
17
+ "sbe.enable.access.order.checks" ,
18
+ Boolean .toString (ENABLE_BOUNDS_CHECKS )));
15
19
16
20
/**
17
21
* The states in which a encoder/decoder/codec can live.
@@ -123,7 +127,7 @@ public FrameCodecDecoder wrap(
123
127
this .actingVersion = actingVersion ;
124
128
limit (offset + actingBlockLength );
125
129
126
- if (DEBUG_MODE )
130
+ if (ENABLE_ACCESS_ORDER_CHECKS )
127
131
{
128
132
switch (actingVersion ) {
129
133
case 0 :
@@ -171,7 +175,7 @@ public int sbeDecodedLength()
171
175
final int decodedLength = encodedLength ();
172
176
limit (currentLimit );
173
177
174
- if (DEBUG_MODE )
178
+ if (ENABLE_ACCESS_ORDER_CHECKS )
175
179
{
176
180
codecState (currentCodecState );
177
181
}
@@ -241,7 +245,7 @@ public static int irIdMaxValue()
241
245
242
246
public int irId ()
243
247
{
244
- if (DEBUG_MODE )
248
+ if (ENABLE_ACCESS_ORDER_CHECKS )
245
249
{
246
250
if (codecState () == CodecState .NOT_WRAPPED )
247
251
{
@@ -300,7 +304,7 @@ public static int irVersionMaxValue()
300
304
301
305
public int irVersion ()
302
306
{
303
- if (DEBUG_MODE )
307
+ if (ENABLE_ACCESS_ORDER_CHECKS )
304
308
{
305
309
if (codecState () == CodecState .NOT_WRAPPED )
306
310
{
@@ -359,7 +363,7 @@ public static int schemaVersionMaxValue()
359
363
360
364
public int schemaVersion ()
361
365
{
362
- if (DEBUG_MODE )
366
+ if (ENABLE_ACCESS_ORDER_CHECKS )
363
367
{
364
368
if (codecState () == CodecState .NOT_WRAPPED )
365
369
{
@@ -403,7 +407,7 @@ public static int packageNameHeaderLength()
403
407
404
408
public int packageNameLength ()
405
409
{
406
- if (DEBUG_MODE )
410
+ if (ENABLE_ACCESS_ORDER_CHECKS )
407
411
{
408
412
switch (codecState ())
409
413
{
@@ -421,7 +425,7 @@ public int packageNameLength()
421
425
422
426
public int skipPackageName ()
423
427
{
424
- if (DEBUG_MODE )
428
+ if (ENABLE_ACCESS_ORDER_CHECKS )
425
429
{
426
430
switch (codecState ())
427
431
{
@@ -444,7 +448,7 @@ public int skipPackageName()
444
448
445
449
public int getPackageName (final MutableDirectBuffer dst , final int dstOffset , final int length )
446
450
{
447
- if (DEBUG_MODE )
451
+ if (ENABLE_ACCESS_ORDER_CHECKS )
448
452
{
449
453
switch (codecState ())
450
454
{
@@ -468,7 +472,7 @@ public int getPackageName(final MutableDirectBuffer dst, final int dstOffset, fi
468
472
469
473
public int getPackageName (final byte [] dst , final int dstOffset , final int length )
470
474
{
471
- if (DEBUG_MODE )
475
+ if (ENABLE_ACCESS_ORDER_CHECKS )
472
476
{
473
477
switch (codecState ())
474
478
{
@@ -492,7 +496,7 @@ public int getPackageName(final byte[] dst, final int dstOffset, final int lengt
492
496
493
497
public void wrapPackageName (final DirectBuffer wrapBuffer )
494
498
{
495
- if (DEBUG_MODE )
499
+ if (ENABLE_ACCESS_ORDER_CHECKS )
496
500
{
497
501
switch (codecState ())
498
502
{
@@ -513,7 +517,7 @@ public void wrapPackageName(final DirectBuffer wrapBuffer)
513
517
514
518
public String packageName ()
515
519
{
516
- if (DEBUG_MODE )
520
+ if (ENABLE_ACCESS_ORDER_CHECKS )
517
521
{
518
522
switch (codecState ())
519
523
{
@@ -573,7 +577,7 @@ public static int namespaceNameHeaderLength()
573
577
574
578
public int namespaceNameLength ()
575
579
{
576
- if (DEBUG_MODE )
580
+ if (ENABLE_ACCESS_ORDER_CHECKS )
577
581
{
578
582
switch (codecState ())
579
583
{
@@ -591,7 +595,7 @@ public int namespaceNameLength()
591
595
592
596
public int skipNamespaceName ()
593
597
{
594
- if (DEBUG_MODE )
598
+ if (ENABLE_ACCESS_ORDER_CHECKS )
595
599
{
596
600
switch (codecState ())
597
601
{
@@ -614,7 +618,7 @@ public int skipNamespaceName()
614
618
615
619
public int getNamespaceName (final MutableDirectBuffer dst , final int dstOffset , final int length )
616
620
{
617
- if (DEBUG_MODE )
621
+ if (ENABLE_ACCESS_ORDER_CHECKS )
618
622
{
619
623
switch (codecState ())
620
624
{
@@ -638,7 +642,7 @@ public int getNamespaceName(final MutableDirectBuffer dst, final int dstOffset,
638
642
639
643
public int getNamespaceName (final byte [] dst , final int dstOffset , final int length )
640
644
{
641
- if (DEBUG_MODE )
645
+ if (ENABLE_ACCESS_ORDER_CHECKS )
642
646
{
643
647
switch (codecState ())
644
648
{
@@ -662,7 +666,7 @@ public int getNamespaceName(final byte[] dst, final int dstOffset, final int len
662
666
663
667
public void wrapNamespaceName (final DirectBuffer wrapBuffer )
664
668
{
665
- if (DEBUG_MODE )
669
+ if (ENABLE_ACCESS_ORDER_CHECKS )
666
670
{
667
671
switch (codecState ())
668
672
{
@@ -683,7 +687,7 @@ public void wrapNamespaceName(final DirectBuffer wrapBuffer)
683
687
684
688
public String namespaceName ()
685
689
{
686
- if (DEBUG_MODE )
690
+ if (ENABLE_ACCESS_ORDER_CHECKS )
687
691
{
688
692
switch (codecState ())
689
693
{
@@ -743,7 +747,7 @@ public static int semanticVersionHeaderLength()
743
747
744
748
public int semanticVersionLength ()
745
749
{
746
- if (DEBUG_MODE )
750
+ if (ENABLE_ACCESS_ORDER_CHECKS )
747
751
{
748
752
switch (codecState ())
749
753
{
@@ -761,7 +765,7 @@ public int semanticVersionLength()
761
765
762
766
public int skipSemanticVersion ()
763
767
{
764
- if (DEBUG_MODE )
768
+ if (ENABLE_ACCESS_ORDER_CHECKS )
765
769
{
766
770
switch (codecState ())
767
771
{
@@ -784,7 +788,7 @@ public int skipSemanticVersion()
784
788
785
789
public int getSemanticVersion (final MutableDirectBuffer dst , final int dstOffset , final int length )
786
790
{
787
- if (DEBUG_MODE )
791
+ if (ENABLE_ACCESS_ORDER_CHECKS )
788
792
{
789
793
switch (codecState ())
790
794
{
@@ -808,7 +812,7 @@ public int getSemanticVersion(final MutableDirectBuffer dst, final int dstOffset
808
812
809
813
public int getSemanticVersion (final byte [] dst , final int dstOffset , final int length )
810
814
{
811
- if (DEBUG_MODE )
815
+ if (ENABLE_ACCESS_ORDER_CHECKS )
812
816
{
813
817
switch (codecState ())
814
818
{
@@ -832,7 +836,7 @@ public int getSemanticVersion(final byte[] dst, final int dstOffset, final int l
832
836
833
837
public void wrapSemanticVersion (final DirectBuffer wrapBuffer )
834
838
{
835
- if (DEBUG_MODE )
839
+ if (ENABLE_ACCESS_ORDER_CHECKS )
836
840
{
837
841
switch (codecState ())
838
842
{
@@ -853,7 +857,7 @@ public void wrapSemanticVersion(final DirectBuffer wrapBuffer)
853
857
854
858
public String semanticVersion ()
855
859
{
856
- if (DEBUG_MODE )
860
+ if (ENABLE_ACCESS_ORDER_CHECKS )
857
861
{
858
862
switch (codecState ())
859
863
{
0 commit comments