1 /* 2 * Copyright 2019 Google LLC 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package io.perfmark.java6; 18 19 import io.perfmark.impl.Generator; 20 21 final class SecretVolatileGenerator { 22 23 // @UsedReflectively 24 public static final class VolatileGenerator extends Generator { 25 26 // @UsedReflectively VolatileGenerator()27 public VolatileGenerator() {} 28 29 private volatile long gen; 30 31 @Override setGeneration(long generation)32 public void setGeneration(long generation) { 33 gen = generation; 34 } 35 36 @Override getGeneration()37 public long getGeneration() { 38 return gen; 39 } 40 41 @Override costOfGetNanos()42 public long costOfGetNanos() { 43 return 3; 44 } 45 46 @Override costOfSetNanos()47 public long costOfSetNanos() { 48 return 10; 49 } 50 } 51 SecretVolatileGenerator()52 private SecretVolatileGenerator() { 53 throw new AssertionError("nope"); 54 } 55 } 56