Javadoc for the service.
| 14 | |
| 15 | /** Javadoc for the service. */ |
| 16 | @Service |
| 17 | @Component("torture") |
| 18 | public class TortureService extends BaseService implements Runnable, AutoCloseable { |
| 19 | /** A shared constant table (value-ref target). */ |
| 20 | public static final Map<String, Integer> RETRY_LIMITS = Map.of("a", 1); |
| 21 | private static final String API_BASE = "https://example.test"; |
| 22 | protected int count = 0; |
| 23 | private final List<String> names; |
| 24 | int packagePrivate, secondDeclarator; |
| 25 | /** Field initializers — walked scoped to the field (#693). */ |
| 26 | private final Runnable fieldLambda = () -> helper(RETRY_LIMITS); |
| 27 | private final Runnable fieldAnonClass = new Runnable() { |
| 28 | @Override |
| 29 | public void run() { |
| 30 | helper(RETRY_LIMITS); |
| 31 | } |
| 32 | }; |
| 33 | private final Runnable fieldMethodRef = TortureService::compute; |
| 34 | private static final List<Runnable> FIELD_TABLE = List.of(TortureService::compute); |
| 35 | |
| 36 | /** Ctor javadoc. */ |
| 37 | public TortureService(List<String> names) { |
| 38 | this.names = requireNonNull(names); |
| 39 | register(this::onEvent); |
| 40 | queue(TortureService::compute); |
| 41 | queue(OtherClass::handle); |
| 42 | Runnable r = () -> helper(RETRY_LIMITS); |
| 43 | executor.submit(new Runnable() { |
| 44 | @Override |
| 45 | public void run() { |
| 46 | helper(RETRY_LIMITS); |
| 47 | } |
| 48 | }); |
| 49 | } |
| 50 | |
| 51 | @Override |
| 52 | @Deprecated |
| 53 | public void run() { |
| 54 | Config cfg = ConfigLoader.getInstance().load(); |
| 55 | this.registry.lookup("x"); |
| 56 | helper(Direction.UP); |
| 57 | String base = API_BASE; |
| 58 | int max = Limits.MAX_VALUE; |
| 59 | new StringBuilder(16).append(base); |
| 60 | } |
| 61 | |
| 62 | private static Config helper(Object arg) { |
| 63 | return new Config(); |
| 64 | } |
| 65 | |
| 66 | private void onEvent() {} |
| 67 | private static void compute() {} |
| 68 | |
| 69 | public void shadowed() { |
| 70 | String API_BASE = "local"; // shadows the class constant |
| 71 | log(API_BASE); |
| 72 | } |
| 73 |