├── .github └── workflows │ ├── codeql.yml │ ├── maven.yml │ └── settings.xml ├── .gitignore ├── .travis.settings.xml ├── .travis.yml ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── README.md ├── checkstyle_checks.xml ├── findbugs_exclude.xml ├── licenseheader.txt ├── pom.xml ├── sonar-project.properties ├── spf4j-aether ├── pom.xml └── src │ ├── main │ └── java │ │ └── org │ │ └── spf4j │ │ └── maven │ │ ├── ClassifierDependencyFilter.java │ │ └── MavenRepositoryUtils.java │ └── test │ └── java │ └── org │ └── spf4j │ └── maven │ └── MavenRepositoryUtilsTest.java ├── spf4j-asm ├── pom.xml └── src │ ├── main │ └── java │ │ └── org │ │ └── spf4j │ │ └── base │ │ └── asm │ │ ├── Invocation.java │ │ ├── MethodInvocationClassVisitor.java │ │ ├── Scanner.java │ │ ├── TypeUtils.java │ │ └── UnknownValue.java │ └── test │ └── java │ └── org │ └── spf4j │ └── base │ └── asm │ ├── Scanner2Test.java │ ├── Scanner3Test.java │ ├── Scanner4Test.java │ └── ScannerTest.java ├── spf4j-aspects ├── pom.xml └── src │ ├── main │ └── java │ │ └── org │ │ └── spf4j │ │ ├── annotations │ │ ├── PerformanceMonitor.java │ │ ├── RecorderSourceInstance.java │ │ └── Retry.java │ │ ├── aspects │ │ └── RetryAspect.java │ │ └── perf │ │ └── aspects │ │ ├── AllocationMonitorAspect.java │ │ ├── FileMonitorAspect.java │ │ ├── NetworkMonitorAspect.java │ │ ├── PerformanceMonitorAspect.java │ │ ├── SamplingAllocationMonitorAspect.java │ │ └── ThreadLocalCounter.java │ ├── site │ └── site.xml │ └── test │ ├── java │ └── org │ │ └── spf4j │ │ └── perf │ │ ├── aspects │ │ ├── AllocationMonitorAspectTest.java │ │ ├── FileMonitorAspectTest.java │ │ ├── NetworkMonitorAspectTest.java │ │ ├── PerformanceMonitorAspectTest.java │ │ └── SamplingAllocationMonitorAspectTest.java │ │ └── memory │ │ └── TestClass.java │ └── resources │ └── META-INF │ └── aop.xml ├── spf4j-avro-components ├── maven-avro-schema-plugin │ ├── pom.xml │ └── src │ │ ├── it │ │ ├── mrm │ │ │ └── settings.xml │ │ └── projects │ │ │ ├── test-1 │ │ │ ├── invoker.properties │ │ │ ├── pom.xml │ │ │ ├── test-common │ │ │ │ ├── pom.xml │ │ │ │ └── src │ │ │ │ │ └── main │ │ │ │ │ └── avro │ │ │ │ │ ├── common-test.avpr │ │ │ │ │ └── common.avdl │ │ │ ├── test-schema-2 │ │ │ │ ├── pom.xml │ │ │ │ └── src │ │ │ │ │ └── main │ │ │ │ │ └── avro │ │ │ │ │ ├── common_local.avdl │ │ │ │ │ └── core.avdl │ │ │ ├── test-schema-3 │ │ │ │ ├── pom.xml │ │ │ │ └── src │ │ │ │ │ └── main │ │ │ │ │ └── avro │ │ │ │ │ ├── common_local.avdl │ │ │ │ │ └── core.avdl │ │ │ └── test-schema │ │ │ │ ├── pom.xml │ │ │ │ └── src │ │ │ │ └── main │ │ │ │ └── avro │ │ │ │ ├── common_local.avdl │ │ │ │ └── core.avdl │ │ │ ├── test-2 │ │ │ ├── invoker.properties │ │ │ ├── pom.xml │ │ │ ├── test-common │ │ │ │ ├── pom.xml │ │ │ │ └── src │ │ │ │ │ └── main │ │ │ │ │ └── avro │ │ │ │ │ └── common.avdl │ │ │ ├── test-schema-2 │ │ │ │ ├── pom.xml │ │ │ │ └── src │ │ │ │ │ └── main │ │ │ │ │ └── avro │ │ │ │ │ ├── common_local.avdl │ │ │ │ │ └── core.avdl │ │ │ ├── test-schema-3 │ │ │ │ ├── pom.xml │ │ │ │ └── src │ │ │ │ │ └── main │ │ │ │ │ └── avro │ │ │ │ │ ├── common_local.avdl │ │ │ │ │ └── core.avdl │ │ │ └── test-schema │ │ │ │ ├── pom.xml │ │ │ │ └── src │ │ │ │ └── main │ │ │ │ └── avro │ │ │ │ ├── common_local.avdl │ │ │ │ └── core.avdl │ │ │ ├── test-3 │ │ │ ├── invoker.properties │ │ │ └── pom.xml │ │ │ ├── test-4 │ │ │ ├── invoker.properties │ │ │ ├── pom.xml │ │ │ └── src │ │ │ │ └── main │ │ │ │ └── avro │ │ │ │ └── common.avdl │ │ │ └── test-5 │ │ │ ├── invoker.properties │ │ │ ├── pom.xml │ │ │ └── src │ │ │ └── main │ │ │ └── avro │ │ │ ├── A.avsc │ │ │ └── B.avsc │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── spf4j │ │ │ │ └── maven │ │ │ │ └── plugin │ │ │ │ └── avro │ │ │ │ └── avscp │ │ │ │ ├── SchemaCompileMojo.java │ │ │ │ ├── SchemaDependenciesMojo.java │ │ │ │ ├── SchemaMojoBase.java │ │ │ │ ├── SchemaPackageMojo.java │ │ │ │ ├── SchemaValidatorMojo.java │ │ │ │ ├── SourceLocation.java │ │ │ │ ├── ValidatorMojo.java │ │ │ │ └── validation │ │ │ │ ├── Validator.java │ │ │ │ ├── Validators.java │ │ │ │ └── impl │ │ │ │ ├── SchemaCompatibilityValidator.java │ │ │ │ ├── SchemaDocValidator.java │ │ │ │ └── SchemaNamesValidator.java │ │ └── resources │ │ │ └── META-INF │ │ │ └── plexus │ │ │ └── components.xml │ │ ├── site │ │ ├── apt │ │ │ ├── index.apt.vm │ │ │ └── usage.apt.vm │ │ └── site.xml │ │ └── test │ │ └── java │ │ └── org │ │ └── spf4j │ │ └── maven │ │ └── plugin │ │ └── avro │ │ └── avscp │ │ ├── SourceLocationTest.java │ │ └── validation │ │ └── impl │ │ └── SchemaCompatibilityValidatorTest.java ├── pom.xml ├── spf4j-avro-adapter-fork │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── org │ │ └── spf4j │ │ └── avro │ │ └── zfork │ │ └── ZForkAvroAdapter.java ├── spf4j-avro-adapter-official │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── org │ │ ├── apache │ │ └── avro │ │ │ └── io │ │ │ └── EncoderAdapter.java │ │ └── spf4j │ │ └── avro │ │ └── official │ │ └── OfficialAvroAdapter.java ├── spf4j-avro-adapter │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── org │ │ └── spf4j │ │ └── avro │ │ ├── Adapter.java │ │ ├── AvroCompatUtils.java │ │ ├── SchemaResolver.java │ │ └── Yaml.java ├── spf4j-avro-lib-ext │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── org │ │ └── apache │ │ └── avro │ │ ├── ExtendedAvroNamesRefResolver.java │ │ ├── ExtendedNames.java │ │ ├── ExtendedParser.java │ │ ├── SchemaAdapter.java │ │ ├── SchemaRefWriter.java │ │ ├── SchemaResolver.java │ │ ├── SchemaResolverRegistration.java │ │ ├── SchemaResolvers.java │ │ ├── UnresolvedExtendedParser.java │ │ └── avsc │ │ ├── ResolvingVisitor.java │ │ ├── SchemaResolver.java │ │ ├── SchemaVisitor.java │ │ ├── SchemaVisitorAction.java │ │ └── Schemas.java └── spf4j-avro │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── org │ │ │ ├── apache │ │ │ ├── avro │ │ │ │ ├── ArrayIterator.java │ │ │ │ ├── AvroArrayWriter.java │ │ │ │ ├── ImmutableField.java │ │ │ │ ├── ImmutableSchema.java │ │ │ │ ├── MapIterator.java │ │ │ │ └── reflect │ │ │ │ │ └── ExtendedReflectData.java │ │ │ └── calcite │ │ │ │ └── interpreter │ │ │ │ └── Spf4jDataContext.java │ │ │ └── spf4j │ │ │ └── avro │ │ │ ├── AvroDataSet.java │ │ │ ├── DecodedSchema.java │ │ │ ├── GenericRecordBuilder.java │ │ │ ├── SchemaRef.java │ │ │ ├── SqlPredicate.java │ │ │ ├── calcite │ │ │ ├── AbstractAvroTable.java │ │ │ ├── AvroDataSetAsProjectableFilterableTable.java │ │ │ ├── AvroEnumerable.java │ │ │ ├── AvroFilterableTable.java │ │ │ ├── AvroIteratorAsProjectableFilterableTable.java │ │ │ ├── AvroSupplier.java │ │ │ ├── EmbededDataContext.java │ │ │ ├── FilterUtils.java │ │ │ ├── FilteredProjectedSupplier.java │ │ │ ├── FilteringProjectingAvroEnumerable.java │ │ │ ├── IndexedRecords.java │ │ │ ├── InterpreterUtils.java │ │ │ ├── PlannerUtils.java │ │ │ ├── SqlConverters.java │ │ │ ├── SqlRowPredicate.java │ │ │ ├── TableAccessDeniedException.java │ │ │ └── Types.java │ │ │ ├── csv │ │ │ ├── CsvDecoder.java │ │ │ └── CsvEncoder.java │ │ │ └── schema │ │ │ ├── CloningVisitor.java │ │ │ ├── ImmutableCloningVisitor.java │ │ │ ├── SchemaDiff.java │ │ │ ├── SchemaUtils.java │ │ │ ├── SchemaVisitor.java │ │ │ ├── SchemaVisitorAction.java │ │ │ ├── Schemas.java │ │ │ └── SchemasWithClasses.java │ └── resources │ │ └── org │ │ └── spf4j │ │ └── avro │ │ ├── enum.vm │ │ ├── fixed.vm │ │ ├── protocol.vm │ │ └── record.vm │ └── test │ ├── java │ └── org │ │ └── spf4j │ │ └── avro │ │ ├── GenericRecordBuilderTest.java │ │ ├── calcite │ │ ├── AvroQueryTest.java │ │ └── FilterUtilsTest.java │ │ ├── csv │ │ └── CsvEncoderTest.java │ │ └── schema │ │ ├── SchemaUtilsTest.java │ │ └── SchemasTest.java │ └── resources │ └── SchemaBuilder.avsc ├── spf4j-config-discovery-maven-plugin ├── pom.xml └── src │ ├── it │ ├── settings.xml │ └── simple-it │ │ ├── pom.xml │ │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── org │ │ │ └── spf4j │ │ │ └── MyTestClass.java │ │ └── verify.groovy │ └── main │ └── java │ └── org │ └── spf4j │ └── config_discovery │ └── maven │ └── plugin │ ├── ConfigScannerMojo.java │ ├── FieldInfo.java │ └── JsonUtils.java ├── spf4j-core-gwt ├── pom.xml └── src │ └── main │ └── resources │ └── org │ └── spf4j │ ├── ForceSpf4jCompilation.gwt.xml │ ├── ForceSpf4jCompilationEntryPoint.java │ └── base │ └── Base.gwt.xml ├── spf4j-core ├── pom.xml └── src │ ├── main │ └── java │ │ └── org │ │ └── spf4j │ │ ├── avro │ │ └── Configs.java │ │ ├── base │ │ ├── AbstractRunnable.java │ │ ├── AlmostSafe.java │ │ ├── AppendableUtils.java │ │ ├── ArrayBuilder.java │ │ ├── ArrayWriter.java │ │ ├── Arrays.java │ │ ├── Base64.java │ │ ├── BasicExecutionContext.java │ │ ├── Callables.java │ │ ├── CallablesNano.java │ │ ├── CharArrayConsumer.java │ │ ├── CharSequences.java │ │ ├── CheckedRunnable.java │ │ ├── CloneFailedException.java │ │ ├── CloseableIterable.java │ │ ├── CloseableIterator.java │ │ ├── Closeables.java │ │ ├── ComparablePair.java │ │ ├── Comparables.java │ │ ├── ContextValue.java │ │ ├── CoreTextMediaType.java │ │ ├── DateTimeFormats.java │ │ ├── ESupplier.java │ │ ├── Either.java │ │ ├── Env.java │ │ ├── EqualsPredicate.java │ │ ├── ErrLog.java │ │ ├── EscapeJsonStringAppendableWrapper.java │ │ ├── ExecutionContext.java │ │ ├── ExecutionContextFactory.java │ │ ├── ExecutionContexts.java │ │ ├── ExitException.java │ │ ├── Handler.java │ │ ├── HandlerNano.java │ │ ├── Holder.java │ │ ├── InstrumentationHelper.java │ │ ├── IntAppender.java │ │ ├── IntMath.java │ │ ├── IntSequence.java │ │ ├── Invocation.java │ │ ├── Iterables.java │ │ ├── JNA.java │ │ ├── JavaUtils.java │ │ ├── Json.java │ │ ├── JsonReader.java │ │ ├── JsonWriteable.java │ │ ├── LangIdEncDec.java │ │ ├── MapWriter.java │ │ ├── MemorizedCallable.java │ │ ├── Methods.java │ │ ├── MutableHolder.java │ │ ├── MutableInteger.java │ │ ├── NameValue.java │ │ ├── NoExitSecurityManager.java │ │ ├── NullAbleOptional.java │ │ ├── Objects.java │ │ ├── Operations.java │ │ ├── PackageInfo.java │ │ ├── Pair.java │ │ ├── ParameterizedException.java │ │ ├── ParameterizedSupplier.java │ │ ├── ReferenceType.java │ │ ├── Reflections.java │ │ ├── RemoteException.java │ │ ├── ResultMatchers.java │ │ ├── Runnables.java │ │ ├── Runtime.java │ │ ├── SerializablePair.java │ │ ├── ShutdownHooks.java │ │ ├── ShutdownThread.java │ │ ├── Slf4jMessageFormatter.java │ │ ├── StackSamples.java │ │ ├── Strings.java │ │ ├── SuppressForbiden.java │ │ ├── SuppressedThrowable.java │ │ ├── SysExits.java │ │ ├── TLScratch.java │ │ ├── ThreadLocalContextAttacher.java │ │ ├── Threads.java │ │ ├── ThrowableMatcher.java │ │ ├── Throwables.java │ │ ├── TimeSource.java │ │ ├── TimeoutDeadline.java │ │ ├── TimeoutRunnable.java │ │ ├── Timing.java │ │ ├── UncheckedExecutionException.java │ │ ├── UncheckedTimeoutException.java │ │ ├── UnsafeString.java │ │ ├── UnsafeThrowable.java │ │ ├── Version.java │ │ ├── Wrapper.java │ │ ├── Writeable.java │ │ ├── XCollectors.java │ │ ├── XRuntime.java │ │ └── avro │ │ │ ├── AThrowables.java │ │ │ ├── AvroCloseableIterable.java │ │ │ ├── AvroContainer.java │ │ │ ├── Converters.java │ │ │ ├── MediaTypes.java │ │ │ ├── RemoteException.java │ │ │ └── package-info.java │ │ ├── concurrent │ │ ├── AtomicReferenceExt.java │ │ ├── AtomicSequence.java │ │ ├── Atomics.java │ │ ├── CompoundPermitSupplier.java │ │ ├── CompoundSemaphore.java │ │ ├── ConcurrentStack.java │ │ ├── ContextPropagatingCompletableFuture.java │ │ ├── ContextPropagatingExecutorService.java │ │ ├── ContextPropagatingScheduledExecutorService.java │ │ ├── ContextPropagator.java │ │ ├── CustomThreadFactory.java │ │ ├── DefaultContextAwareExecutor.java │ │ ├── DefaultContextAwareScheduledExecutor.java │ │ ├── DefaultExecutor.java │ │ ├── DefaultScheduler.java │ │ ├── FileBasedLock.java │ │ ├── FutureBean.java │ │ ├── Futures.java │ │ ├── InterruptibleCompletableFuture.java │ │ ├── LifoThreadPool.java │ │ ├── LifoThreadPoolBuilder.java │ │ ├── LifoThreadPoolExecutorSQP.java │ │ ├── LocalSemaphore.java │ │ ├── LockRuntimeException.java │ │ ├── MutableLifoThreadPool.java │ │ ├── NonPoolingExecutorService.java │ │ ├── PermitSupplier.java │ │ ├── RejectedExecutionHandler.java │ │ ├── RestartableService.java │ │ ├── RestartableServiceImpl.java │ │ ├── ScalableSequence.java │ │ ├── Semaphore.java │ │ ├── Sequence.java │ │ ├── ThreadLocalBufferedConsumer.java │ │ ├── UIDGenerator.java │ │ ├── UnboundedLoadingCache.java │ │ ├── UnboundedLoadingCache2.java │ │ ├── UnboundedRacyLoadingCache.java │ │ ├── UpdateResult.java │ │ └── jdbc │ │ │ ├── HeartBeatError.java │ │ │ ├── HeartBeatTableDesc.java │ │ │ ├── JdbcHeartBeat.java │ │ │ ├── JdbcLock.java │ │ │ ├── JdbcSemaphore.java │ │ │ ├── OwnerPermits.java │ │ │ ├── ProcessLimitedJdbcSemaphore.java │ │ │ └── SemaphoreTablesDesc.java │ │ ├── ds │ │ ├── CopyOnWriteMap.java │ │ ├── Graphs.java │ │ ├── IdentityHashSet.java │ │ ├── LinkedHashMapEx.java │ │ ├── LinkedHashSetEx.java │ │ ├── LinkedMap.java │ │ ├── LinkedSet.java │ │ ├── RTree.java │ │ ├── SimpleStack.java │ │ ├── SimpleStackNullSupport.java │ │ └── UpdateablePriorityQueue.java │ │ ├── failsafe │ │ ├── AsyncRetryExecutor.java │ │ ├── AsyncRetryExecutorImpl.java │ │ ├── CountLimitedPartialRetryPredicate.java │ │ ├── DefaultAsyncExecutor.java │ │ ├── DefaultRetryPredicate.java │ │ ├── FibonacciRetryDelaySupplier.java │ │ ├── GuavaRateLimiter.java │ │ ├── Hedge.java │ │ ├── HedgePolicy.java │ │ ├── InvalidRetryPolicyException.java │ │ ├── JitteredDelaySupplier.java │ │ ├── LimitingExecutor.java │ │ ├── NotEnoughTimeToRetry.java │ │ ├── PartialExceptionRetryPredicate.java │ │ ├── PartialExceptionRetryPredicateSupplier.java │ │ ├── PartialResultRetryPredicate.java │ │ ├── PartialResultRetryPredicateSupplier.java │ │ ├── PartialTypedExceptionRetryPredicate.java │ │ ├── RateLimiter.java │ │ ├── RetriedResultException.java │ │ ├── RetryDecision.java │ │ ├── RetryDecisionFactory.java │ │ ├── RetryDelaySupplier.java │ │ ├── RetryPolicies.java │ │ ├── RetryPolicy.java │ │ ├── RetryPredicate.java │ │ ├── SyncRetryExecutor.java │ │ ├── TimeLimitedPartialRetryPredicate.java │ │ ├── TimedSupplier.java │ │ ├── TimeoutRelativeHedge.java │ │ ├── TimeoutRetryPredicate.java │ │ ├── TypeBasedRetryDelaySupplier.java │ │ ├── concurrent │ │ │ ├── ConditionalConsumer.java │ │ │ ├── DefaultFailSafeExecutor.java │ │ │ ├── DelayedTask.java │ │ │ ├── FailSafeExecutor.java │ │ │ ├── FailSafeExecutorImpl.java │ │ │ ├── FutureTask.java │ │ │ └── RetryFutureTask.java │ │ └── package-info.java │ │ ├── io │ │ ├── AppendableLimiterWithOverflow.java │ │ ├── AppendableOutputStream.java │ │ ├── AppendableWriter.java │ │ ├── BufferedInputStream.java │ │ ├── BufferedOutputStream.java │ │ ├── ByteArrayBuilder.java │ │ ├── CharArrayBuilder.java │ │ ├── ClosedOutputStream.java │ │ ├── ConfigurableAppenderSupplier.java │ │ ├── CountingInputStream.java │ │ ├── Csv.java │ │ ├── DebugInputStream.java │ │ ├── DeletingVisitor.java │ │ ├── EmptyInputStream.java │ │ ├── EmptyReader.java │ │ ├── FSWatchEventSensitivity.java │ │ ├── IOConsumer.java │ │ ├── IOTimeoutException.java │ │ ├── LazyOutputStreamWrapper.java │ │ ├── MemorizingBufferedInputStream.java │ │ ├── NoCloseOutputStream.java │ │ ├── NullOutputStream.java │ │ ├── NullWriter.java │ │ ├── ObjectAppender.java │ │ ├── ObjectAppenderSupplier.java │ │ ├── PathsIOException.java │ │ ├── PipedOutputStream.java │ │ ├── PushbackInputStreamEx.java │ │ ├── PushbackReader.java │ │ ├── ReaderInputStream.java │ │ ├── SetFilesReadOnlyVisitor.java │ │ ├── Streams.java │ │ ├── WriterOutputStream.java │ │ ├── appenders │ │ │ ├── ArrayBooleanAppender.java │ │ │ ├── ArrayBytesAppender.java │ │ │ ├── ArrayCharsAppender.java │ │ │ ├── ArrayDoubleAppender.java │ │ │ ├── ArrayFloatAppender.java │ │ │ ├── ArrayIntAppender.java │ │ │ ├── ArrayLongAppender.java │ │ │ ├── ArrayObjectAppender.java │ │ │ ├── ArrayShortAppender.java │ │ │ ├── CalendarAppender.java │ │ │ ├── CharsequenceAppender.java │ │ │ ├── CollectionAppender.java │ │ │ ├── DateAppender.java │ │ │ ├── GenericRecordAppender.java │ │ │ ├── InstantAppender.java │ │ │ ├── LocalDateAppender.java │ │ │ ├── MapAppender.java │ │ │ ├── NumberAppender.java │ │ │ ├── PathAppender.java │ │ │ ├── SampleNodeAppender.java │ │ │ ├── SpecificRecordAppender.java │ │ │ ├── SpecificRecordBaseAppender.java │ │ │ ├── SqlDateAppender.java │ │ │ ├── ThrowableAppender.java │ │ │ ├── WriteableAppender.java │ │ │ └── json │ │ │ │ ├── ArrayBooleanJsonAppender.java │ │ │ │ ├── ArrayBytesJsonAppender.java │ │ │ │ ├── ArrayCharsJsonAppender.java │ │ │ │ ├── ArrayDoubleJsonAppender.java │ │ │ │ ├── ArrayFloatJsonAppender.java │ │ │ │ ├── ArrayIntJsonAppender.java │ │ │ │ ├── ArrayLongJsonAppender.java │ │ │ │ ├── ArrayObjectJsonAppender.java │ │ │ │ ├── CollectionJsonAppender.java │ │ │ │ ├── GenericRecordJsonAppender.java │ │ │ │ ├── JsonWriteableAppender.java │ │ │ │ ├── MapJsonAppender.java │ │ │ │ ├── NumberJsonAppender.java │ │ │ │ ├── SampleNodeWriteableAppender.java │ │ │ │ ├── SpecificRecordBaseJsonAppender.java │ │ │ │ ├── SpecificRecordJsonAppender.java │ │ │ │ └── ThrowableJsonAppender.java │ │ ├── compress │ │ │ └── Compress.java │ │ ├── csv │ │ │ ├── CharSeparatedValues.java │ │ │ ├── CsvHandler.java │ │ │ ├── CsvMapHandler.java │ │ │ ├── CsvParseException.java │ │ │ ├── CsvReader.java │ │ │ ├── CsvReader2Iterator.java │ │ │ ├── CsvRowHandler.java │ │ │ ├── CsvRuntimeException.java │ │ │ ├── CsvWriter.java │ │ │ ├── ElementAppendable.java │ │ │ ├── IterableCsvReader.java │ │ │ ├── OneRowIterator.java │ │ │ └── UncheckedCsvParseException.java │ │ └── tcp │ │ │ ├── AcceptorSelectorEventHandler.java │ │ │ ├── ClientHandler.java │ │ │ ├── DeadlineAction.java │ │ │ ├── SelectorEventHandler.java │ │ │ ├── TcpServer.java │ │ │ ├── package-info.java │ │ │ └── proxy │ │ │ ├── ProxyBufferTransferHandler.java │ │ │ ├── ProxyClientHandler.java │ │ │ ├── Sniffer.java │ │ │ ├── SnifferFactory.java │ │ │ └── TransferBuffer.java │ │ ├── jdbc │ │ ├── DataSourceEx.java │ │ ├── DataSourceExImpl.java │ │ ├── DbType.java │ │ ├── JdbcTemplate.java │ │ └── SemaphoredConnectionInvocationHandler.java │ │ ├── jmx │ │ ├── BeanExportedValue.java │ │ ├── Client.java │ │ ├── DynamicMBeanBuilder.java │ │ ├── ExportedOperation.java │ │ ├── ExportedOperationImpl.java │ │ ├── ExportedValue.java │ │ ├── ExportedValuesMBean.java │ │ ├── GenericExportedOperation.java │ │ ├── GenericExportedValue.java │ │ ├── GlobalMXBeanMapperSupplier.java │ │ ├── JMXBeanMapping.java │ │ ├── JMXBeanMappingSupplier.java │ │ ├── JmxExport.java │ │ ├── MapExportedValue.java │ │ ├── Registry.java │ │ └── mappers │ │ │ ├── MXBeanMappings.java │ │ │ ├── MapEntryOpenTypeMapping.java │ │ │ ├── SpecificRecordOpenTypeMapping.java │ │ │ ├── Spf4jJMXBeanMapping.java │ │ │ └── Spf4jOpenTypeMapper.java │ │ ├── log │ │ ├── AvroLogRecordImpl.java │ │ ├── ExecContextLogger.java │ │ ├── Level.java │ │ ├── LogAttribute.java │ │ ├── LogPrinter.java │ │ ├── LogUtils.java │ │ ├── SLF4JBridgeHandler.java │ │ ├── SLf4jXLogAdapter.java │ │ ├── Slf4jLogRecord.java │ │ ├── Slf4jLogRecordImpl.java │ │ └── XLog.java │ │ ├── net │ │ ├── SntpClient.java │ │ └── Timing.java │ │ ├── os │ │ ├── LoggingProcessHandler.java │ │ ├── OperatingSystem.java │ │ ├── ProcessHandler.java │ │ ├── ProcessResponse.java │ │ ├── ProcessUtil.java │ │ ├── StdOutLineCountProcessHandler.java │ │ └── StdOutToStringProcessHandler.java │ │ ├── perf │ │ ├── CloseableMeasurementRecorder.java │ │ ├── CloseableMeasurementRecorderSource.java │ │ ├── JmxSupport.java │ │ ├── MeasurementAccumulator.java │ │ ├── MeasurementRecorder.java │ │ ├── MeasurementRecorderSource.java │ │ ├── MeasurementStore.java │ │ ├── MeasurementStoreQuery.java │ │ ├── MeasurementsInfo.java │ │ ├── MeasurementsSource.java │ │ ├── MeasurmentStoreUtils.java │ │ ├── MultiMeasurementRecorder.java │ │ ├── PerformanceMonitor.java │ │ ├── ProcessVitals.java │ │ ├── TimeSeriesAggregatingIterator.java │ │ ├── TimeSeriesRecord.java │ │ ├── cpu │ │ │ ├── CpuUsageSampler.java │ │ │ └── ThreadUsageSampler.java │ │ ├── impl │ │ │ ├── DirectRecorderSource.java │ │ │ ├── MeasurementsInfoImpl.java │ │ │ ├── NopMeasurementRecorder.java │ │ │ ├── NopMeasurementRecorderSource.java │ │ │ ├── NopMeasurementStore.java │ │ │ ├── ProcessMeasurementStore.java │ │ │ ├── Quanta.java │ │ │ ├── RecorderFactory.java │ │ │ ├── ScalableMeasurementRecorder.java │ │ │ ├── ScalableMeasurementRecorderSource.java │ │ │ ├── acc │ │ │ │ ├── AbstractMeasurementAccumulator.java │ │ │ │ ├── AddAndCountAccumulator.java │ │ │ │ ├── CountAccumulator.java │ │ │ │ ├── DirectStoreAccumulator.java │ │ │ │ ├── DirectStoreMultiAccumulator.java │ │ │ │ ├── MinMaxAvgAccumulator.java │ │ │ │ └── QuantizedAccumulator.java │ │ │ └── ms │ │ │ │ ├── Flusher.java │ │ │ │ ├── Id2Info.java │ │ │ │ ├── MultiStore.java │ │ │ │ ├── StoreFactory.java │ │ │ │ ├── StoreType.java │ │ │ │ ├── graphite │ │ │ │ ├── GraphiteTcpStore.java │ │ │ │ └── GraphiteUdpStore.java │ │ │ │ └── tsdb │ │ │ │ ├── AvroFileInfo.java │ │ │ │ ├── AvroMeasurementStore.java │ │ │ │ ├── AvroMeasurementStoreReader.java │ │ │ │ ├── TSDBMeasurementStore.java │ │ │ │ ├── TSDBMeasurementStoreReader.java │ │ │ │ └── TSDBTxtMeasurementStore.java │ │ ├── io │ │ │ ├── MeasuredInputStream.java │ │ │ ├── MeasuredOutputStream.java │ │ │ └── OpenFilesSampler.java │ │ └── memory │ │ │ ├── GCUsageSampler.java │ │ │ └── MemoryUsageSampler.java │ │ ├── pool │ │ └── jdbc │ │ │ ├── JdbcConnectionFactory.java │ │ │ └── PooledDataSource.java │ │ ├── recyclable │ │ ├── BlockingDisposable.java │ │ ├── Disposable.java │ │ ├── Lease.java │ │ ├── LeaseSupplier.java │ │ ├── NonValidatingRecyclingSupplier.java │ │ ├── ObjectBorower.java │ │ ├── ObjectBorrowException.java │ │ ├── ObjectCreationException.java │ │ ├── ObjectDisposeException.java │ │ ├── ObjectReturnException.java │ │ ├── RecyclerFactory.java │ │ ├── RecyclingSupplier.java │ │ ├── Scanable.java │ │ ├── SizedLeaseSupplier.java │ │ ├── SizedRecyclingSupplier.java │ │ ├── SmartRecyclingSupplier.java │ │ ├── SupplierException.java │ │ ├── Template.java │ │ ├── UsageProvider.java │ │ ├── impl │ │ │ ├── ArraySuppliers.java │ │ │ ├── CollectableThreadLocalRecyclingSupplier.java │ │ │ ├── LeaseImpl.java │ │ │ ├── LocalObjectPool.java │ │ │ ├── ObjectHolder.java │ │ │ ├── ObjectHolderFactory.java │ │ │ ├── ObjectPoolWrapper.java │ │ │ ├── Powerof2SizedGlobalRecyclingSupplier.java │ │ │ ├── Powerof2ThreadLocalRecyclingSupplier.java │ │ │ ├── RecyclingSupplierBuilder.java │ │ │ ├── ScalableObjectPool.java │ │ │ ├── SharingObjectPool.java │ │ │ ├── SimpleSmartObjectPool.java │ │ │ ├── SizedThreadLocalRecyclingSupplier.java │ │ │ └── ThreadLocalRecyclingSupplier.java │ │ └── package-info.java │ │ ├── reflect │ │ ├── ByTypeSupplier.java │ │ ├── CachingTypeMapSupplierWrapper.java │ │ ├── CachingTypeMapWrapper.java │ │ ├── GraphTypeMap.java │ │ └── TypeMap.java │ │ ├── security │ │ ├── AbacAuthorizer.java │ │ ├── AbacSecurityContext.java │ │ ├── AesEncryptorDecryptor.java │ │ ├── EncryptedBytes.java │ │ ├── EncryptedString.java │ │ ├── EncryptorDecryptor.java │ │ └── RbacSecurityContext.java │ │ ├── ssdump2 │ │ ├── Converter.java │ │ └── avro │ │ │ └── package-info.java │ │ ├── stackmonitor │ │ ├── AvroProfilePersister.java │ │ ├── AvroStackSampleSupplier.java │ │ ├── FastStackCollector.java │ │ ├── GCFakeStackUtil.java │ │ ├── ISampler.java │ │ ├── LegacyProfilePersister.java │ │ ├── MethodMap.java │ │ ├── Monitor.java │ │ ├── MxStackCollector.java │ │ ├── ProfileFileFormat.java │ │ ├── ProfileMetaData.java │ │ ├── ProfilePersister.java │ │ ├── ProfiledExecutionContext.java │ │ ├── ProfiledExecutionContextFactory.java │ │ ├── ProfilingTLAttacher.java │ │ ├── SampleNode.java │ │ ├── Sampler.java │ │ ├── SamplerSupplier.java │ │ ├── SimpleStackCollector.java │ │ ├── Spf4jProfilerException.java │ │ ├── StackCollector.java │ │ ├── StackCollectorImpl.java │ │ ├── StackSampleSupplier.java │ │ ├── StackTrace.java │ │ ├── StackVisualizer.java │ │ ├── THash.java │ │ ├── THashMap.java │ │ ├── TObjectHash.java │ │ ├── ThreadSpecificTracingExecutionContextHandler.java │ │ ├── ThreadStackSampler.java │ │ └── TracingExecutionContexSampler.java │ │ ├── text │ │ ├── AttributedString.java │ │ ├── FormatInfo.java │ │ ├── MessageFormat.java │ │ ├── Slf4jFormat.java │ │ ├── Slf4jFormatImpl.java │ │ └── package-info.java │ │ ├── trace │ │ └── avro │ │ │ └── package-info.java │ │ ├── tsdb2 │ │ ├── TSDBQuery.java │ │ ├── TSDBReader.java │ │ ├── TSDBWriter.java │ │ ├── TableDefs.java │ │ ├── TimeSeries.java │ │ └── avro │ │ │ └── package-info.java │ │ └── unix │ │ ├── CLibrary.java │ │ ├── JVMArguments.java │ │ ├── Lsof.java │ │ ├── Ulimit.java │ │ ├── UnixConstants.java │ │ ├── UnixException.java │ │ ├── UnixResources.java │ │ ├── UnixRuntime.java │ │ └── UnixRuntimeException.java │ ├── site │ └── site.xml │ └── test │ ├── java │ └── org │ │ └── spf4j │ │ ├── avro │ │ └── ConfigsTest.java │ │ ├── base │ │ ├── AppendableUtilsTest.java │ │ ├── ArrayBuilderTest.java │ │ ├── ArraysTest.java │ │ ├── Base64Test.java │ │ ├── CallablesTest.java │ │ ├── CharSequencesTest.java │ │ ├── ComparablesTest.java │ │ ├── DefaultSchedulerTest.java │ │ ├── ExecutionContextTest.java │ │ ├── IntMathTest.java │ │ ├── LangIdEncDecTest.java │ │ ├── MemorizedCallableTest.java │ │ ├── OperatingSystemTest.java │ │ ├── OperationsTest.java │ │ ├── PairTest.java │ │ ├── RTreeTest.java │ │ ├── ReflectionsTest.java │ │ ├── RuntimeTest.java │ │ ├── SerializablePairTest.java │ │ ├── Slf4jMessageFormatterTest.java │ │ ├── StringsTest.java │ │ ├── TestException.java │ │ ├── ThrowablesTest.java │ │ ├── TimeSourceTest.java │ │ ├── TimingTest.java │ │ ├── UnixResourcesTest.java │ │ ├── VersionTest.java │ │ └── XCollectorsTest.java │ │ ├── concurrent │ │ ├── CompoundSemaphoreTest.java │ │ ├── ContextPropagatingCompletableFutureTest.java │ │ ├── FileBasedLockTest.java │ │ ├── LifoThreadPoolExecutor2Test.java │ │ ├── LifoThreadPoolExecutorCoreIdlingTest.java │ │ ├── LifoThreadPoolExecutorInterruptingTest.java │ │ ├── LifoThreadPoolExecutorSTest.java │ │ ├── LifoThreadPoolExecutorTest.java │ │ ├── MutableThreadPoolExecutor2Test.java │ │ ├── SequenceTest.java │ │ ├── ThreadPoolExecutorTest.java │ │ ├── UIDGeneratorTest.java │ │ └── jdbc │ │ │ ├── BadSemaphoreHandler.java │ │ │ ├── DecentSemaphoreHandler.java │ │ │ └── JdbcSemaphoreTest.java │ │ ├── ds │ │ ├── LinkedHashMapExTest.java │ │ ├── LinkedHashSetExTest.java │ │ ├── SimpleStackNullSupportTest.java │ │ ├── SimpleStackTest.java │ │ └── UpdateablePriorityQueueTest.java │ │ ├── failsafe │ │ ├── JitteredDelaySupplierTest.java │ │ ├── LimitingExecutorTest.java │ │ ├── RateLimiterTest.java │ │ ├── Request.java │ │ ├── Response.java │ │ ├── RetryPoliciesTest.java │ │ ├── RetryPolicyTest.java │ │ ├── Server.java │ │ ├── ServerCall.java │ │ ├── SyncRetryExecutorTest.java │ │ └── concurrent │ │ │ └── RetryExecutorTest.java │ │ ├── io │ │ ├── AppendableLimiterWithFileOverflowTest.java │ │ ├── CharArrayBuilderTest.java │ │ ├── ConfigurableAppenderSupplierTest.java │ │ ├── CsvTest.java │ │ ├── IOTimeoutExceptionTest.java │ │ ├── MemorizingBufferedInputStreamTest.java │ │ ├── ObjectAppenderTest.java │ │ ├── PipedOutputStreamTest.java │ │ ├── StreamsTest.java │ │ ├── WriterOutputStreamTest.java │ │ ├── appenders │ │ │ └── SpecificRecordAppenderTest.java │ │ ├── compress │ │ │ └── CompressTest.java │ │ ├── csv │ │ │ └── CharSeparatedValuesTest.java │ │ └── proxy │ │ │ └── TcpServerTest.java │ │ ├── jmx │ │ ├── DynamicMBeanBuilderTest.java │ │ ├── OpenTypeConverterTest.java │ │ ├── PropertySource.java │ │ ├── RecursiveTestBean.java │ │ ├── RegistryTest.java │ │ ├── Test.java │ │ ├── TestBean.java │ │ ├── TestEnum.java │ │ └── TestMXBean.java │ │ ├── log │ │ ├── ExecContextLoggerTest.java │ │ ├── LogAttributeTest.java │ │ └── LogPrinterTest.java │ │ ├── net │ │ └── SntpClientTest.java │ │ ├── os │ │ └── OperatingSystemTest.java │ │ ├── perf │ │ ├── PerformanceMonitorTest.java │ │ ├── RecorderFactoryTest.java │ │ ├── cpu │ │ │ └── CpuUsageSamplerTest.java │ │ ├── impl │ │ │ ├── DirectRecorderSourceTest.java │ │ │ ├── GraphiteUdpStoreTest.java │ │ │ ├── RecorderFactoryTest.java │ │ │ ├── acc │ │ │ │ └── QuantizedRecorderTest.java │ │ │ └── ms │ │ │ │ └── tsdb │ │ │ │ ├── AvroMeasurementStoreTest.java │ │ │ │ └── TSDBTxtMeasurementStoreTest.java │ │ └── memory │ │ │ ├── GCUsageSamplerTest.java │ │ │ └── MemoryUsageSamplerTest.java │ │ ├── pool │ │ └── jdbc │ │ │ └── PooledDataSourceTest.java │ │ ├── recyclable │ │ └── impl │ │ │ ├── ExpensiveTestObject.java │ │ │ ├── ExpensiveTestObjectFactory.java │ │ │ ├── ObjectPoolBuilderTest.java │ │ │ ├── SharingObjectPoolTest.java │ │ │ ├── SimpleSmartObjectPoolTest.java │ │ │ ├── SizedGlobalRecyclingSupplierTest.java │ │ │ ├── SizedThreadLocalRecyclingSupplier2Test.java │ │ │ ├── SizedThreadLocalRecyclingSupplierTest.java │ │ │ └── TestCallable.java │ │ ├── reflect │ │ └── GraphTypeMapTest.java │ │ ├── security │ │ ├── AesEncryptorDecryptorTest.java │ │ └── EncryptedStringTest.java │ │ ├── ssdump2 │ │ └── ConverterTest.java │ │ ├── stackmonitor │ │ ├── AvroProfilePersisterTest.java │ │ ├── DemoTest.java │ │ ├── FastStackCollectorTest.java │ │ ├── MethodMapTest.java │ │ ├── MethodsTest.java │ │ ├── MonitorTest.java │ │ ├── SampleNodeTest.java │ │ ├── SamplerTest.java │ │ ├── SimpleStackCollectorTest.java │ │ ├── SsdumpTest.java │ │ ├── StackTraceTest.java │ │ └── TracingExecutionContexSamplerTest.java │ │ ├── test │ │ └── package-info.java │ │ ├── text │ │ └── FastMessageFormatTest.java │ │ ├── tsdb2 │ │ ├── AvroTest.java │ │ ├── TSDBQueryTest.java │ │ └── TSDBReaderTest.java │ │ └── unix │ │ ├── CLibraryTest.java │ │ └── JVMArgumentsTest.java │ └── resources │ ├── heartBeats.sql │ ├── semaphoreTable.sql │ ├── test.csv │ ├── test.ssdump3 │ └── test_bad.csv ├── spf4j-experimental └── hs_err_pid8875.log ├── spf4j-jacoco-aggregate └── pom.xml ├── spf4j-jdiff-maven-plugin ├── pom.xml └── src │ ├── main │ └── java │ │ └── org │ │ └── spf4j │ │ └── jdiff │ │ ├── ApiChangesMojo.java │ │ ├── ApiDescriptorMojo.java │ │ ├── ApiDiffCmd.java │ │ ├── BaseJDiffMojo.java │ │ ├── JDiffRunner.java │ │ ├── JDiffUtils.java │ │ ├── JavadocExecutionException.java │ │ ├── JavadocExecutor.java │ │ └── package-info.java │ ├── site │ ├── apt │ │ ├── index.apt.vm │ │ └── usage.apt.vm │ └── site.xml │ └── test │ └── java │ └── org │ └── spf4j │ └── jdiff │ ├── ApiDiffCmdTest.java │ └── JDiffRunnerTest.java ├── spf4j-jmh-11 ├── pom.xml └── src │ └── main │ └── java │ └── org │ └── spf4j │ └── stackmonitor │ ├── CmdLineUtils.java │ ├── JFRControler.java │ ├── JmhDetailedJFRProfiler.java │ └── RecordingGranularity.java ├── spf4j-jmh ├── pom.xml └── src │ └── main │ └── java │ └── org │ └── spf4j │ └── stackmonitor │ ├── JmhFlightRecorderProfiler.java │ ├── JmhProfiler.java │ └── Spf4jJmhProfiler.java ├── spf4j-joda ├── pom.xml └── src │ └── main │ └── java │ └── org │ └── spf4j │ └── io │ └── appenders │ ├── InstantAppender.java │ └── LocalDateAppender.java ├── spf4j-junit ├── pom.xml └── src │ ├── main │ └── java │ │ └── org │ │ └── spf4j │ │ └── junit │ │ ├── RunListenerRegister.java │ │ └── Spf4jRunListener.java │ ├── site │ ├── markdown │ │ └── index.md │ └── site.xml │ └── test │ └── java │ └── org │ └── spf4j │ └── junit │ ├── RunListenerRegisterTest.java │ └── Spf4jRunListenerTest.java ├── spf4j-maven-schema-resolver ├── pom.xml └── src │ ├── main │ └── java │ │ └── org │ │ └── spf4j │ │ └── maven │ │ ├── CachedSchemaResolver.java │ │ ├── MavenSchemaResolver.java │ │ └── Registerer.java │ └── test │ └── java │ └── org │ └── spf4j │ └── maven │ └── MavenSchemaResolverTest.java ├── spf4j-slf4j-test-junit5 ├── pom.xml └── src │ └── main │ └── java │ └── org │ └── spf4j │ └── test │ └── log │ └── junit5 │ ├── Spf4jTestExecutionExtensions.java │ └── Spf4jTestExecutionListener.java ├── spf4j-slf4j-test ├── pom.xml └── src │ ├── main │ └── java │ │ └── org │ │ ├── junit │ │ └── internal │ │ │ └── runners │ │ │ └── statements │ │ │ └── FailOnTimeout.java │ │ ├── slf4j │ │ └── impl │ │ │ └── TestLoggerServiceProvider.java │ │ └── spf4j │ │ ├── base │ │ └── TestTimeSource.java │ │ └── test │ │ ├── log │ │ ├── AllLevelsLogHandler.java │ │ ├── Attachments.java │ │ ├── CompositeLogHandler.java │ │ ├── ConsumeAllLogs.java │ │ ├── DefaultAsserter.java │ │ ├── ExactLogStreamMatcher.java │ │ ├── ExceptionHandoverRegistry.java │ │ ├── GreedyLogPrinter.java │ │ ├── HandlerRegistration.java │ │ ├── LogAssert.java │ │ ├── LogCollection.java │ │ ├── LogCollectorHandler.java │ │ ├── LogConfig.java │ │ ├── LogConfigImpl.java │ │ ├── LogConsumer.java │ │ ├── LogHandler.java │ │ ├── LogMatchingHandler.java │ │ ├── LogMatchingHandlerAsync.java │ │ ├── LogPrinter.java │ │ ├── LogStreamMatcher.java │ │ ├── ObservationAssert.java │ │ ├── PrintConfig.java │ │ ├── PrintLogConfigsIO.java │ │ ├── TestLogRecord.java │ │ ├── TestLogRecordImpl.java │ │ ├── TestLogger.java │ │ ├── TestLoggers.java │ │ ├── TestUtils.java │ │ ├── UncaughtExceptionAsserter.java │ │ ├── UncaughtExceptionConsumer.java │ │ ├── UncaughtExceptionDetail.java │ │ ├── ValidationUtils.java │ │ ├── annotations │ │ │ ├── CollectLogs.java │ │ │ ├── ExpectLog.java │ │ │ ├── ExpectLogs.java │ │ │ ├── PrintLogs.java │ │ │ ├── PrintLogsConfigs.java │ │ │ └── package-info.java │ │ ├── junit4 │ │ │ ├── DetailOnFailureRunListener.java │ │ │ ├── ExceptionAsserterUncaughtExceptionHandler.java │ │ │ ├── Spf4jTestLogJUnitRunner.java │ │ │ ├── Spf4jTestLogRunListener.java │ │ │ ├── Spf4jTestLogRunListenerSingleton.java │ │ │ └── TestBaggage.java │ │ └── package-info.java │ │ └── matchers │ │ ├── LogMatchers.java │ │ ├── PatternMatcher.java │ │ └── PredicateMatcher.java │ ├── site │ ├── markdown │ │ └── index.md │ └── site.xml │ └── test │ ├── java │ └── org │ │ └── spf4j │ │ ├── base │ │ └── TestTimeSourceTest.java │ │ └── test │ │ ├── log │ │ ├── LogConfigImplTest.java │ │ ├── PrintLogConfigsIOTest.java │ │ ├── TestGlobalErrorIgnore.java │ │ ├── TestLoggerFactoryTest.java │ │ ├── TestLoggerFactoryTest2.java │ │ └── TestUtilsTest.java │ │ └── matchers │ │ └── LogMatchersTest.java │ └── resources │ ├── spf4j-test-prtcfg-ide.properties │ ├── spf4j-test-prtcfg.properties │ └── test-config.properties ├── spf4j-ui ├── pom.xml └── src │ ├── main │ ├── dict │ │ └── Info.plist.template │ └── java │ │ └── org │ │ └── spf4j │ │ ├── perf │ │ ├── impl │ │ │ └── chart │ │ │ │ ├── Charts.java │ │ │ │ ├── InverseGrayScale.java │ │ │ │ ├── QuantizedNumberTickUnit.java │ │ │ │ ├── QuantizedXYZDatasetImpl.java │ │ │ │ └── TimestampTickUnitImpl.java │ │ └── tsdb │ │ │ ├── DataFragment.java │ │ │ ├── Header.java │ │ │ ├── TSDataHandler.java │ │ │ ├── TSTable.java │ │ │ ├── TableOfContents.java │ │ │ ├── TimeSeriesDatabase.java │ │ │ └── package-info.java │ │ ├── stackmonitor │ │ └── SampleGraph.java │ │ ├── tsdb2 │ │ ├── Charts.java │ │ └── Charts2.java │ │ └── ui │ │ ├── Arrow2D.java │ │ ├── ComparisonStackDumpJInternalFrame.form │ │ ├── ComparisonStackDumpJInternalFrame.java │ │ ├── ComposableFileFilter.java │ │ ├── Explorer.form │ │ ├── Explorer.java │ │ ├── FlameStackPanel.java │ │ ├── HotFlameStackPanel.java │ │ ├── MStoreViewJInternalFrame.form │ │ ├── MStoreViewJInternalFrame.java │ │ ├── MultiStackSampleSupplier.java │ │ ├── OneStackSampleSupplier.java │ │ ├── Rectangle.java │ │ ├── Sampled.java │ │ ├── Spf4jFileFilter.java │ │ ├── StackDumpJInternalFrame.form │ │ ├── StackDumpJInternalFrame.java │ │ ├── StackPanelBase.java │ │ ├── TSDB2ViewJInternalFrame.form │ │ ├── TSDB2ViewJInternalFrame.java │ │ ├── TSDBViewJInternalFrame.form │ │ ├── TSDBViewJInternalFrame.java │ │ ├── TextEntryPanel.form │ │ ├── TextEntryPanel.java │ │ └── UncaughtExceptionDisplayer.java │ └── test │ ├── java │ └── org │ │ └── spf4j │ │ ├── perf │ │ ├── impl │ │ │ └── chart │ │ │ │ └── ChartsTest.java │ │ └── tsdb │ │ │ ├── TSDBTailerTest.java │ │ │ └── TimeSeriesDatabaseTest.java │ │ ├── stackmonitor │ │ └── SampleGraphTest.java │ │ └── ui │ │ ├── Arrow2DTest.java │ │ ├── ExplorerTest.java │ │ ├── FlameStackPanelTest.java │ │ ├── LatchWindowCloseListener.java │ │ └── package-info.java │ └── resources │ ├── 19156@ZMacBookPro.local.tsdb │ ├── com.google.common.io.AppendableWriterBenchmark.spf4jAppendable-Throughput.ssdump2 │ ├── jaxrs-spf4j-demo-54557c8c9d-5ndf9_20211030T141848576Z_20211030T151933489Z.ssdump3.gz │ ├── org.spf4j.concurrent.ThreadPoolBenchmark.spfLifoTpBenchmark-Throughput_m4.ssdump2 │ ├── test8381720042200787335.tsdb2 │ └── testProfile.ssp.avro ├── spf4j-zel-javax ├── pom.xml └── src │ ├── main │ └── java │ │ └── org │ │ └── spf4j │ │ └── zel │ │ └── javax │ │ ├── ZelBindings.java │ │ ├── ZelCompiledScript.java │ │ ├── ZelScriptContext.java │ │ ├── ZelScriptEngine.java │ │ └── ZelScriptEngineFactory.java │ └── test │ └── java │ └── org │ └── spf4j │ └── zel │ └── javax │ └── ZelScriptEngineTest.java ├── spf4j-zel ├── fb-exclude.xml ├── nbactions.xml ├── pom.xml ├── src │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── spf4j │ │ │ │ └── zel │ │ │ │ ├── instr │ │ │ │ ├── ABS.java │ │ │ │ ├── ADD.java │ │ │ │ ├── AND.java │ │ │ │ ├── ARR.java │ │ │ │ ├── CALL.java │ │ │ │ ├── CALLA.java │ │ │ │ ├── CALLREF.java │ │ │ │ ├── CDEREFX.java │ │ │ │ ├── DEC.java │ │ │ │ ├── DEREF.java │ │ │ │ ├── DEREFX.java │ │ │ │ ├── DIV.java │ │ │ │ ├── DUP.java │ │ │ │ ├── EQ.java │ │ │ │ ├── FIRST.java │ │ │ │ ├── FJMP.java │ │ │ │ ├── GE.java │ │ │ │ ├── GT.java │ │ │ │ ├── HALT.java │ │ │ │ ├── INC.java │ │ │ │ ├── Instruction.java │ │ │ │ ├── JMP.java │ │ │ │ ├── LE.java │ │ │ │ ├── LODAX.java │ │ │ │ ├── LODAXF.java │ │ │ │ ├── LODX.java │ │ │ │ ├── LODXF.java │ │ │ │ ├── LT.java │ │ │ │ ├── MCTX.java │ │ │ │ ├── MOD.java │ │ │ │ ├── MOV.java │ │ │ │ ├── MOVN.java │ │ │ │ ├── MUL.java │ │ │ │ ├── NEQ.java │ │ │ │ ├── NJMP.java │ │ │ │ ├── NOP.java │ │ │ │ ├── NOT.java │ │ │ │ ├── OR.java │ │ │ │ ├── POW.java │ │ │ │ ├── PUSH.java │ │ │ │ ├── PUSHM.java │ │ │ │ ├── REF.java │ │ │ │ ├── RLIKE.java │ │ │ │ ├── SLEEP.java │ │ │ │ ├── SUB.java │ │ │ │ ├── SWAP.java │ │ │ │ ├── SYNC.java │ │ │ │ ├── SymbolRef.java │ │ │ │ ├── THROW.java │ │ │ │ ├── XOR.java │ │ │ │ ├── package-info.java │ │ │ │ └── var │ │ │ │ │ ├── ARRAY.java │ │ │ │ │ ├── DECODE.java │ │ │ │ │ ├── INT.java │ │ │ │ │ ├── LIST.java │ │ │ │ │ ├── LOG.java │ │ │ │ │ ├── LOG10.java │ │ │ │ │ ├── MAP.java │ │ │ │ │ ├── MAX.java │ │ │ │ │ ├── MIN.java │ │ │ │ │ ├── NVL.java │ │ │ │ │ ├── OUT.java │ │ │ │ │ ├── RANDOM.java │ │ │ │ │ └── SQRT.java │ │ │ │ ├── operators │ │ │ │ ├── AbstractOps.java │ │ │ │ ├── BigDecimalOperators.java │ │ │ │ ├── BigIntegerOperators.java │ │ │ │ ├── DoubleOperators.java │ │ │ │ ├── IntegerOperators.java │ │ │ │ ├── LongOperators.java │ │ │ │ ├── Operator.java │ │ │ │ ├── Operators.java │ │ │ │ └── package-info.java │ │ │ │ └── vm │ │ │ │ ├── Address.java │ │ │ │ ├── AssignableValue.java │ │ │ │ ├── Channel.java │ │ │ │ ├── CompileContext.java │ │ │ │ ├── CompileException.java │ │ │ │ ├── ExecAbortException.java │ │ │ │ ├── ExecutionContext.java │ │ │ │ ├── JavaMethodCall.java │ │ │ │ ├── MemoryBuilder.java │ │ │ │ ├── Method.java │ │ │ │ ├── NullParsingContext.java │ │ │ │ ├── ParsingContext.java │ │ │ │ ├── ProcessIO.java │ │ │ │ ├── ProcessIOStreams.java │ │ │ │ ├── Program.java │ │ │ │ ├── ProgramBuilder.java │ │ │ │ ├── RefOptimizer.java │ │ │ │ ├── ResultCache.java │ │ │ │ ├── SimpleResultCache.java │ │ │ │ ├── SuspendedException.java │ │ │ │ ├── VMASyncFuture.java │ │ │ │ ├── VMExecutor.java │ │ │ │ ├── VMFuture.java │ │ │ │ ├── VMSyncFuture.java │ │ │ │ ├── ZExecutionException.java │ │ │ │ ├── ZelFrame.java │ │ │ │ ├── ZelPredicate.java │ │ │ │ └── gen │ │ │ │ └── package-info.java │ │ └── javacc │ │ │ └── org │ │ │ └── spf4j │ │ │ └── zel │ │ │ └── vm │ │ │ └── ZCompiler.jj │ ├── site │ │ ├── apt │ │ │ └── index.apt │ │ └── site.xml │ └── test │ │ ├── java │ │ └── org │ │ │ └── spf4j │ │ │ └── zel │ │ │ └── vm │ │ │ ├── AvroTest.java │ │ │ ├── ChannelTest.java │ │ │ ├── CommentsTest.java │ │ │ ├── CondDerefTest.java │ │ │ ├── ExceptionsTest.java │ │ │ ├── JavaMethodTest.java │ │ │ ├── LikeTest.java │ │ │ ├── MinMaxTest.java │ │ │ ├── QSortTest.java │ │ │ ├── Scratch.java │ │ │ ├── SleepSortTest.java │ │ │ ├── StringEvalTest.java │ │ │ ├── TestDecimalOperations.java │ │ │ ├── TestDoubleOperations.java │ │ │ ├── TestLongOperations.java │ │ │ ├── TestReplica.java │ │ │ ├── TestZelMultiThreaded.java │ │ │ ├── TestZelSingleThreaded.java │ │ │ └── ZelTest.java │ │ └── resources │ │ └── org │ │ └── spf4j │ │ └── zel │ │ └── vm │ │ ├── channel.zel │ │ ├── comments.zel │ │ ├── minmax.zel │ │ ├── parallelPi.zel │ │ ├── replicas.zel │ │ ├── sleepSort.zel │ │ ├── sort.zel │ │ ├── sortFunc.zel │ │ └── stringEscaping.zel └── todo.txt └── src └── site ├── markdown ├── index.md ├── logging.md ├── metrics.md ├── misc.md └── profiling.md ├── resources ├── images │ ├── ContextCorelatedProfiling.svg │ ├── MetricsFlow.svg │ ├── MonitoringDiagram.svg │ ├── explorer-ui.png │ ├── spf4j-flame-graph.png │ ├── spf4j_allocations.png │ ├── spf4j_dist.png │ ├── spf4j_io.png │ └── spf4j_min_max_avg.png └── jaxrs-spf4j-demo_20200131T160810753Z_20200131T170850286Z.ssdump3.gz └── site.xml /.github/workflows/codeql.yml: -------------------------------------------------------------------------------- 1 | name: "CodeQL" 2 | 3 | on: 4 | push: 5 | branches: [ "master" ] 6 | pull_request: 7 | branches: [ "master" ] 8 | schedule: 9 | - cron: "20 20 * * 0" 10 | 11 | jobs: 12 | analyze: 13 | name: Analyze 14 | runs-on: ubuntu-latest 15 | permissions: 16 | actions: read 17 | contents: read 18 | security-events: write 19 | 20 | strategy: 21 | fail-fast: false 22 | matrix: 23 | language: [ java ] 24 | 25 | steps: 26 | - name: Checkout 27 | uses: actions/checkout@v3 28 | 29 | - name: Initialize CodeQL 30 | uses: github/codeql-action/init@v2 31 | with: 32 | languages: ${{ matrix.language }} 33 | queries: +security-and-quality 34 | 35 | - name: Autobuild 36 | uses: github/codeql-action/autobuild@v2 37 | 38 | - name: Perform CodeQL Analysis 39 | uses: github/codeql-action/analyze@v2 40 | with: 41 | category: "/language:${{ matrix.language }}" 42 | -------------------------------------------------------------------------------- /.github/workflows/maven.yml: -------------------------------------------------------------------------------- 1 | name: Java CI 2 | 3 | on: [push] 4 | 5 | jobs: 6 | build: 7 | 8 | runs-on: ubuntu-latest 9 | env: 10 | GITHUB_ACTION: true 11 | DISPLAY: :99.0 12 | GITHUB_PKG_TOKEN: ${{ secrets.REPO_TOKEN }} 13 | steps: 14 | - uses: actions/checkout@v2 15 | 16 | - name: Set up JDK 1.8 17 | uses: actions/setup-java@v2 18 | with: 19 | distribution: 'adopt' 20 | java-version: 8.0.312+7 21 | cache: maven 22 | 23 | - name: Set up JDK 11 24 | uses: AdoptOpenJDK/install-jdk@v1 25 | with: 26 | version: '11' 27 | architecture: x64 28 | targets: 'JDK_11' 29 | 30 | - name: run/xfb 31 | run: "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16" 32 | 33 | - name: Build with Maven 34 | run: mvn -T 1C -s .github/workflows/settings.xml -B package -Djava8.home=${JAVA_HOME} -Djava11.home=${JDK_11} --file pom.xml 35 | -------------------------------------------------------------------------------- /.github/workflows/settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | github 9 | 10 | 11 | 12 | 13 | github 14 | 15 | 16 | 17 | true 18 | 19 | sonatype-snapshot 20 | Sonatype Snapshot Repository 21 | https://oss.sonatype.org/content/repositories/snapshots 22 | 23 | 24 | github 25 | https://maven.pkg.github.com/zolyfarkas/* 26 | 27 | true 28 | 29 | 30 | 31 | 32 | 33 | github-plugins 34 | https://maven.pkg.github.com/zolyfarkas/* 35 | 36 | true 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | github 46 | zolyfarkas 47 | ${env.GITHUB_PKG_TOKEN} 48 | 49 | 50 | github-plugins 51 | zolyfarkas 52 | ${env.GITHUB_PKG_TOKEN} 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /.travis.settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | github 9 | 10 | 11 | 12 | 13 | github 14 | 15 | 16 | 17 | true 18 | 19 | sonatype-snapshot 20 | Sonatype Snapshot Repository 21 | https://oss.sonatype.org/content/repositories/snapshots 22 | 23 | 24 | github 25 | https://maven.pkg.github.com/zolyfarkas/* 26 | 27 | true 28 | 29 | 30 | 31 | 32 | 33 | github-plugins 34 | https://maven.pkg.github.com/zolyfarkas/* 35 | 36 | true 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | github 46 | zolyfarkas 47 | ${env.GITHUB_PKG_TOKEN} 48 | 49 | 50 | github-plugins 51 | zolyfarkas 52 | ${env.GITHUB_PKG_TOKEN} 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | dist: trusty 2 | 3 | language: java 4 | 5 | cache: 6 | directories: 7 | - $HOME/.m2 8 | 9 | jdk: 10 | - oraclejdk8 11 | 12 | before_script: 13 | - "export DISPLAY=:99.0" 14 | - jdk_switcher use openjdk11 15 | 16 | 17 | script: mvn -T 1C -s .travis.settings.xml -B -Djava8.home=/usr/lib/jvm/java-8-oracle -Djava11.home=/home/travis/openjdk11 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -Dgpg.skip=true install 18 | 19 | before_install: 20 | - cp .travis.settings.xml $HOME/.m2/settings.xml 21 | - wget https://github.com/sormuras/bach/raw/master/install-jdk.sh && . ./install-jdk.sh -F 11 --target /home/travis/openjdk11 --os linux-x64 22 | - jdk_switcher use oraclejdk8 23 | - echo "MAVEN_OPTS='-Xmx1024m'" > ~/.mavenrc 24 | - sudo apt-get install jq 25 | - echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca- 26 | - wget -O ~/codacy-coverage-reporter-assembly-latest.jar https://github.com/codacy/codacy-coverage-reporter/releases/download/4.0.1/codacy-coverage-reporter-4.0.1-assembly.jar 27 | - "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16" 28 | 29 | install: mvn -T 1C -s .travis.settings.xml -B -Djava8.home=/usr/lib/jvm/java-8-oracle -Djava11.home=/home/travis/openjdk11 -DskipTests=true -Dmaven.javadoc.skip=true -Dspotbugs.skip=true -Dcheckstyle.skip=true -Dgpg.skip=true -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn install 30 | 31 | after_success: 32 | - ${JAVA_HOME}/bin/java -jar ~/codacy-coverage-reporter-assembly-latest.jar report -l Java -r ./spf4j-jacoco-aggregate/target/site/jacoco-aggregate/jacoco.xml 33 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Contributors and Contributions are welcome. 2 | 3 | 1) For questions please contact us on Gitter: [![Gitter chat](https://badges.gitter.im/zolyfarkas/spf4j.png)](https://gitter.im/spf4j/Lobby) 4 | 2) For bug fixes, enhancements, file an issue. The more detail the better, even better if you have code ready to commit. 5 | 3) For code contributions create a [PR](https://help.github.com/articles/creating-a-pull-request/) 6 | 7 | Spf4j uses Coverity, Findbugs, Checkstyle, Codacy, Junit, Jacoco, Jmh to make sure the SPF4J library is as high quality as possible. 8 | 9 | Good coding! 10 | -------------------------------------------------------------------------------- /findbugs_exclude.xml: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /sonar-project.properties: -------------------------------------------------------------------------------- 1 | sonar.projectKey=zolyfarkas_spf4j 2 | -------------------------------------------------------------------------------- /spf4j-aether/src/main/java/org/spf4j/maven/ClassifierDependencyFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 SPF4J. 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 | package org.spf4j.maven; 17 | 18 | import java.util.List; 19 | import org.eclipse.aether.graph.DependencyFilter; 20 | import org.eclipse.aether.graph.DependencyNode; 21 | 22 | /** 23 | * @author Zoltan Farkas 24 | */ 25 | public final class ClassifierDependencyFilter implements DependencyFilter { 26 | 27 | private final String classifier; 28 | 29 | public ClassifierDependencyFilter(final String classifier) { 30 | this.classifier = classifier; 31 | } 32 | 33 | @Override 34 | public boolean accept(final DependencyNode node, final List parents) { 35 | return classifier.equals(node.getArtifact().getClassifier()); 36 | } 37 | 38 | @Override 39 | public String toString() { 40 | return "ClassifierDependencyFilter{" + "classifier=" + classifier + '}'; 41 | } 42 | 43 | 44 | } 45 | -------------------------------------------------------------------------------- /spf4j-aspects/src/site/site.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | SPF4J Aspects 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | org.apache.maven.skins 20 | maven-fluido-skin 21 | 1.7 22 | 23 | 24 | 25 | false 26 | true 27 | width: 90%; 28 | 29 | 30 | -------------------------------------------------------------------------------- /spf4j-avro-components/maven-avro-schema-plugin/src/it/mrm/settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | it-repo 5 | @mrm.repository.url@ 6 | * 7 | 8 | 9 | 10 | 11 | it-repo 12 | 13 | 14 | local.central 15 | http://local.central 16 | 17 | true 18 | 19 | 20 | true 21 | 22 | 23 | 24 | 25 | 26 | local.central 27 | http://local.central 28 | 29 | true 30 | 31 | 32 | true 33 | 34 | 35 | 36 | 37 | 38 | 39 | it-repo 40 | 41 | -------------------------------------------------------------------------------- /spf4j-avro-components/maven-avro-schema-plugin/src/it/projects/test-1/invoker.properties: -------------------------------------------------------------------------------- 1 | invoker.goals = clean deploy 2 | -------------------------------------------------------------------------------- /spf4j-avro-components/maven-avro-schema-plugin/src/it/projects/test-1/test-common/src/main/avro/common.avdl: -------------------------------------------------------------------------------- 1 | @namespace("org.spf4j.base.avro") 2 | protocol Common { 3 | 4 | /** record representing a key value pair */ 5 | record KeyValue { 6 | /** the key */ 7 | string key; 8 | /** the value, value can be null to allow storing everything a java String field can */ 9 | union {null, string} value = null; 10 | } 11 | 12 | 13 | } -------------------------------------------------------------------------------- /spf4j-avro-components/maven-avro-schema-plugin/src/it/projects/test-1/test-schema-2/src/main/avro/common_local.avdl: -------------------------------------------------------------------------------- 1 | @namespace("org.spf4j.base.avro") 2 | protocol CommonLocal { 3 | 4 | /** record representing a key value pair */ 5 | record LocalKeyValue { 6 | /** the key */ 7 | string key; 8 | /** the value, value can be null to allow storing everything a java String field can */ 9 | union {null, string} value = null; 10 | } 11 | 12 | 13 | } -------------------------------------------------------------------------------- /spf4j-avro-components/maven-avro-schema-plugin/src/it/projects/test-1/test-schema-3/src/main/avro/common_local.avdl: -------------------------------------------------------------------------------- 1 | @namespace("org.spf4j.base.avro") 2 | protocol CommonLocal { 3 | 4 | /** record representing a key value pair */ 5 | record LocalKeyValue { 6 | /** the key */ 7 | string key; 8 | /** the value, value can be null to allow storing everything a java String field can */ 9 | union {null, string} value = null; 10 | } 11 | 12 | 13 | } -------------------------------------------------------------------------------- /spf4j-avro-components/maven-avro-schema-plugin/src/it/projects/test-1/test-schema/src/main/avro/common_local.avdl: -------------------------------------------------------------------------------- 1 | @namespace("org.spf4j.base.avro") 2 | protocol CommonLocal { 3 | 4 | /** record representing a key value pair */ 5 | record LocalKeyValue { 6 | /** the key */ 7 | string key; 8 | /** the value, value can be null to allow storing everything a java String field can */ 9 | union {null, string} value = null; 10 | } 11 | 12 | 13 | } -------------------------------------------------------------------------------- /spf4j-avro-components/maven-avro-schema-plugin/src/it/projects/test-1/test-schema/src/main/avro/core.avdl: -------------------------------------------------------------------------------- 1 | @namespace("org.spf4j.base.avro") 2 | protocol Core { 3 | 4 | import idl "common.avdl"; 5 | 6 | import idl "common_local.avdl"; 7 | 8 | /** record representing a jar archive info */ 9 | record JPackageInfo { 10 | /** the package url */ 11 | string url = ""; 12 | /** version from manifest */ 13 | string version = ""; 14 | 15 | /** some key value for test*/ 16 | LocalKeyValue @aliases(["kv"]) keyValue = {"key" : "la", "value" : null}; 17 | } 18 | 19 | /** a location in a file */ 20 | record JFileLocation { 21 | /** file name */ 22 | string fileName; 23 | /** line number */ 24 | int lineNumber; 25 | } 26 | 27 | /** record representing the samples where a particular method was executed */ 28 | record JStackTraceElement { 29 | /** java class name */ 30 | string className; 31 | /** java method name */ 32 | string methodName; 33 | /** location, null when no location available */ 34 | union {null, JFileLocation} location; 35 | /** package info, null when no package info is available */ 36 | union {null, JPackageInfo} packageInfo; 37 | } 38 | 39 | /** a throwable */ 40 | record JThrowable { 41 | /** exception class name */ 42 | string className; 43 | /** exception message, java exception messages can be null */ 44 | union { null, string } message = null; 45 | /** the stack trace */ 46 | array stackTrace = []; 47 | /** exception cause, null when there is no cause */ 48 | union {null, JThrowable} cause = null; 49 | /** suppressed exceptions */ 50 | array suppressed = []; 51 | /** some key values */ 52 | array values = []; 53 | } 54 | 55 | } -------------------------------------------------------------------------------- /spf4j-avro-components/maven-avro-schema-plugin/src/it/projects/test-2/invoker.properties: -------------------------------------------------------------------------------- 1 | invoker.goals = clean deploy 2 | invoker.buildResult = failure 3 | -------------------------------------------------------------------------------- /spf4j-avro-components/maven-avro-schema-plugin/src/it/projects/test-2/test-common/src/main/avro/common.avdl: -------------------------------------------------------------------------------- 1 | @namespace("org.spf4j.base.avro") 2 | protocol Common { 3 | 4 | /** record representing a key value pair */ 5 | record KeyValue { 6 | /** the key */ 7 | string key; 8 | /** the value, value can be null to allow storing everything a java String field can */ 9 | union {null, string} value = null; 10 | } 11 | 12 | 13 | } -------------------------------------------------------------------------------- /spf4j-avro-components/maven-avro-schema-plugin/src/it/projects/test-2/test-schema-2/src/main/avro/common_local.avdl: -------------------------------------------------------------------------------- 1 | @namespace("org.spf4j.base.avro") 2 | protocol CommonLocal { 3 | 4 | /** record representing a key value pair */ 5 | record LocalKeyValue { 6 | /** the key */ 7 | string key; 8 | /** the value, value can be null to allow storing everything a java String field can */ 9 | union {null, string} value = null; 10 | } 11 | 12 | 13 | } -------------------------------------------------------------------------------- /spf4j-avro-components/maven-avro-schema-plugin/src/it/projects/test-2/test-schema-3/src/main/avro/common_local.avdl: -------------------------------------------------------------------------------- 1 | @namespace("org.spf4j.base.avro") 2 | protocol CommonLocal { 3 | 4 | /** record representing a key value pair */ 5 | record LocalKeyValue { 6 | /** the key */ 7 | string key; 8 | /** the value, value can be null to allow storing everything a java String field can */ 9 | union {null, string} value = null; 10 | } 11 | 12 | 13 | } -------------------------------------------------------------------------------- /spf4j-avro-components/maven-avro-schema-plugin/src/it/projects/test-2/test-schema/src/main/avro/common_local.avdl: -------------------------------------------------------------------------------- 1 | @namespace("org.spf4j.base.avro") 2 | protocol CommonLocal { 3 | 4 | /** record representing a key value pair */ 5 | record LocalKeyValue { 6 | /** the key */ 7 | string key; 8 | /** the value, value can be null to allow storing everything a java String field can */ 9 | union {null, string} value = null; 10 | } 11 | 12 | 13 | } -------------------------------------------------------------------------------- /spf4j-avro-components/maven-avro-schema-plugin/src/it/projects/test-2/test-schema/src/main/avro/core.avdl: -------------------------------------------------------------------------------- 1 | @namespace("org.spf4j.base.avro") 2 | protocol Core { 3 | 4 | import idl "common.avdl"; 5 | 6 | import idl "common_local.avdl"; 7 | 8 | /** record representing a jar archive info */ 9 | record JPackageInfo { 10 | /** the package url */ 11 | string url = ""; 12 | /** version from manifest */ 13 | string version = ""; 14 | 15 | /** some key value for test*/ 16 | LocalKeyValue kv = {"key" : "la", "value" : null}; 17 | } 18 | 19 | /** a location in a file */ 20 | record JFileLocation { 21 | /** file name */ 22 | string fileName; 23 | /** line number */ 24 | int lineNumber; 25 | } 26 | 27 | /** record representing the samples where a particular method was executed */ 28 | record JStackTraceElement { 29 | /** java class name */ 30 | string className; 31 | /** java method name */ 32 | string methodName; 33 | /** location, null when no location available */ 34 | union {null, JFileLocation} location; 35 | /** package info, null when no package info is available */ 36 | union {null, JPackageInfo} packageInfo; 37 | } 38 | 39 | /** a throwable */ 40 | record JThrowable { 41 | /** exception class name */ 42 | string className; 43 | /** exception message, java exception messages can be null */ 44 | union { null, string } message = null; 45 | /** the stack trace */ 46 | array stackTrace = []; 47 | /** exception cause, null when there is no cause */ 48 | union {null, JThrowable} cause = null; 49 | /** suppressed exceptions */ 50 | array suppressed = []; 51 | /** some key values */ 52 | array values = []; 53 | } 54 | 55 | } -------------------------------------------------------------------------------- /spf4j-avro-components/maven-avro-schema-plugin/src/it/projects/test-3/invoker.properties: -------------------------------------------------------------------------------- 1 | invoker.goals = clean deploy 2 | -------------------------------------------------------------------------------- /spf4j-avro-components/maven-avro-schema-plugin/src/it/projects/test-4/invoker.properties: -------------------------------------------------------------------------------- 1 | invoker.goals = clean deploy 2 | -------------------------------------------------------------------------------- /spf4j-avro-components/maven-avro-schema-plugin/src/it/projects/test-4/src/main/avro/common.avdl: -------------------------------------------------------------------------------- 1 | @namespace("org.spf4j.base.avro") 2 | protocol Common { 3 | 4 | /** record representing a key value pair */ 5 | record KeyValue { 6 | /** the key */ 7 | string key; 8 | /** the value, value can be null to allow storing everything a java String field can */ 9 | union {null, string} value = null; 10 | } 11 | 12 | 13 | } -------------------------------------------------------------------------------- /spf4j-avro-components/maven-avro-schema-plugin/src/it/projects/test-5/invoker.properties: -------------------------------------------------------------------------------- 1 | invoker.goals = clean deploy 2 | -------------------------------------------------------------------------------- /spf4j-avro-components/maven-avro-schema-plugin/src/it/projects/test-5/src/main/avro/A.avsc: -------------------------------------------------------------------------------- 1 | { 2 | "type": "record", 3 | "namespace": "com.example.avro", 4 | "name": "A", 5 | "fields": [ 6 | { 7 | "name": "b", 8 | "type": "B" 9 | }, 10 | { 11 | "name": "field", 12 | "type": ["null", "string"], 13 | "default": null 14 | } 15 | ] 16 | } -------------------------------------------------------------------------------- /spf4j-avro-components/maven-avro-schema-plugin/src/it/projects/test-5/src/main/avro/B.avsc: -------------------------------------------------------------------------------- 1 | { 2 | "type": "record", 3 | "namespace": "com.example.avro", 4 | "name": "B", 5 | "fields": [ 6 | { 7 | "name": "id", 8 | "type": "string", 9 | "logicalType": "uuid" 10 | }, 11 | { 12 | "name": "timestamp", 13 | "type": "long", 14 | "logicalType": "timestamp-millis" 15 | } 16 | ] 17 | } -------------------------------------------------------------------------------- /spf4j-avro-components/maven-avro-schema-plugin/src/main/java/org/spf4j/maven/plugin/avro/avscp/ValidatorMojo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 SPF4J. 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 | package org.spf4j.maven.plugin.avro.avscp; 17 | 18 | import java.io.File; 19 | import java.util.Map; 20 | import org.apache.maven.execution.MavenSession; 21 | import org.apache.maven.plugin.logging.Log; 22 | import org.apache.maven.project.MavenProject; 23 | import org.eclipse.aether.RepositorySystem; 24 | 25 | /** 26 | * Interface to abstract the Validator MOJO for the Validators. 27 | */ 28 | public interface ValidatorMojo { 29 | 30 | Map getValidatorConfigs(); 31 | 32 | RepositorySystem getRepoSystem(); 33 | 34 | MavenSession getMavenSession(); 35 | 36 | MavenProject getMavenProject(); 37 | 38 | File getGeneratedAvscTarget(); 39 | 40 | File getTarget(); 41 | 42 | Log getLog(); 43 | 44 | } 45 | -------------------------------------------------------------------------------- /spf4j-avro-components/maven-avro-schema-plugin/src/site/site.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | false 7 | true 8 | width: 90%; 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /spf4j-avro-components/maven-avro-schema-plugin/src/test/java/org/spf4j/maven/plugin/avro/avscp/SourceLocationTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 SPF4J. 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 | package org.spf4j.maven.plugin.avro.avscp; 17 | 18 | import org.junit.Assert; 19 | import org.junit.Test; 20 | 21 | /** 22 | * 23 | * @author Zoltan Farkas 24 | */ 25 | public class SourceLocationTest { 26 | 27 | 28 | 29 | @Test 30 | public void testSourceLocation() { 31 | SourceLocation sl = new SourceLocation("src/main/avro/txn/BlBla.avdl:6:5"); 32 | Assert.assertEquals(6, sl.getLineNr()); 33 | Assert.assertEquals(5, sl.getColNr()); 34 | Assert.assertEquals("src/main/avro/txn/BlBla.avdl", sl.getFilePath()); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /spf4j-avro-components/maven-avro-schema-plugin/src/test/java/org/spf4j/maven/plugin/avro/avscp/validation/impl/SchemaCompatibilityValidatorTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 SPF4J. 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 | package org.spf4j.maven.plugin.avro.avscp.validation.impl; 17 | 18 | import org.apache.avro.Schema; 19 | import org.apache.avro.SchemaBuilder; 20 | import org.hamcrest.Matchers; 21 | import org.junit.Assert; 22 | import org.junit.Test; 23 | 24 | /** 25 | * 26 | * @author Zoltan Farkas 27 | */ 28 | public class SchemaCompatibilityValidatorTest { 29 | 30 | @Test 31 | public void testDiff() { 32 | 33 | Schema rec1 = SchemaBuilder.record("test") 34 | .fields() 35 | .nullableLong("testField", 0).endRecord(); 36 | 37 | Schema rec2 = SchemaBuilder.record("test") 38 | .fields() 39 | .nullableInt("testField", 0).endRecord(); 40 | String diff = SchemaCompatibilityValidator.diff(rec1, rec2); 41 | 42 | // System.out.println(SchemaCompatibilityValidator.diff(rec1, rec2)); 43 | Assert.assertThat(diff, Matchers.containsString("int")); 44 | Assert.assertThat(diff, Matchers.containsString("long")); 45 | 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /spf4j-avro-components/spf4j-avro-adapter-official/src/main/java/org/apache/avro/io/EncoderAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 SPF4J. 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 | package org.apache.avro.io; 17 | 18 | import com.fasterxml.jackson.core.JsonGenerator; 19 | import java.io.IOException; 20 | import org.apache.avro.Schema; 21 | 22 | /** 23 | * adapter to expose some package protected functionality. 24 | * @author Zoltan Farkas 25 | */ 26 | public final class EncoderAdapter { 27 | 28 | private EncoderAdapter() { } 29 | 30 | public static JsonEncoder jsonEncoder(final Schema schema, final JsonGenerator gen) throws IOException { 31 | return new JsonEncoder(schema, gen); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /spf4j-avro-components/spf4j-avro-lib-ext/src/main/java/org/apache/avro/ExtendedAvroNamesRefResolver.java: -------------------------------------------------------------------------------- 1 | package org.apache.avro; 2 | 3 | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 4 | 5 | /* 6 | * Copyright 2020 SPF4J. 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | /** 22 | * @author Zoltan Farkas 23 | */ 24 | @SuppressFBWarnings({ "SE_BAD_FIELD", "SE_NO_SERIALVERSIONID" }) 25 | public final class ExtendedAvroNamesRefResolver extends ExtendedNames { 26 | 27 | private final SchemaResolver sResolver; 28 | 29 | public ExtendedAvroNamesRefResolver(final SchemaResolver sResolver) { 30 | this.sResolver = sResolver; 31 | } 32 | 33 | public ExtendedAvroNamesRefResolver(final SchemaResolver sClient, final String nameSpace) { 34 | super(nameSpace); 35 | this.sResolver = sClient; 36 | } 37 | 38 | public String getId(final Schema schema) { 39 | return sResolver.getId(schema); 40 | } 41 | 42 | public Schema resolveSchema(final String id) { 43 | return sResolver.resolveSchema(id); 44 | } 45 | 46 | @Override 47 | public String toString() { 48 | return "AvroNamesRefResolver{" + "sResolver=" + sResolver + '}'; 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /spf4j-avro-components/spf4j-avro-lib-ext/src/main/java/org/apache/avro/ExtendedNames.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 SPF4J. 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 | package org.apache.avro; 17 | 18 | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 19 | 20 | /** 21 | * 22 | * @author Zoltan Farkas 23 | */ 24 | @SuppressFBWarnings("SE_NO_SERIALVERSIONID") 25 | public class ExtendedNames extends Schema.Names { 26 | 27 | public ExtendedNames() { 28 | } 29 | 30 | public ExtendedNames(final String space) { 31 | super(space); 32 | } 33 | 34 | /** 35 | * overwrite for extra name resolution. 36 | * @param o 37 | * @return 38 | */ 39 | @Override 40 | public Schema get(final String o) { 41 | return super.get(o); 42 | } 43 | 44 | 45 | /** 46 | * overwrite for extra name resolution. 47 | * @param o 48 | * @return 49 | */ 50 | @Override 51 | public Schema get(final Object o) { 52 | return super.get(o); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /spf4j-avro-components/spf4j-avro-lib-ext/src/main/java/org/apache/avro/SchemaResolverRegistration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 SPF4J. 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 | package org.apache.avro; 17 | 18 | /** 19 | * 20 | * @author Zoltan Farkas 21 | */ 22 | public interface SchemaResolverRegistration { 23 | 24 | String getName(); 25 | 26 | SchemaResolver getResolver(); 27 | } -------------------------------------------------------------------------------- /spf4j-avro-components/spf4j-avro-lib-ext/src/main/java/org/apache/avro/UnresolvedExtendedParser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 SPF4J. 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 | package org.apache.avro; 17 | 18 | /** 19 | * 20 | * @author Zoltan Farkas 21 | */ 22 | public class UnresolvedExtendedParser extends ExtendedParser { 23 | 24 | public UnresolvedExtendedParser() { 25 | super(new ExtendedNames() { 26 | @Override 27 | public Schema get(final String o) { 28 | Schema result = super.get(o); 29 | if (result == null) { 30 | result = org.apache.avro.avsc.SchemaResolver.unresolvedSchema(o); 31 | } 32 | return result; 33 | } 34 | 35 | }); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /spf4j-avro-components/spf4j-avro-lib-ext/src/main/java/org/apache/avro/avsc/SchemaVisitorAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001 - 2016, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | */ 18 | 19 | package org.apache.avro.avsc; 20 | 21 | public enum SchemaVisitorAction { 22 | 23 | /** 24 | * continue visit. 25 | */ 26 | CONTINUE, 27 | /** 28 | * terminate visit. 29 | */ 30 | TERMINATE, 31 | /** 32 | * when returned from pre non terminal visit method the children of the non terminal are skipped. 33 | * afterVisitNonTerminal for the current schema will not be invoked. 34 | */ 35 | SKIP_SUBTREE, 36 | /** 37 | * Skip visiting the siblings of this schema. 38 | */ 39 | SKIP_SIBLINGS; 40 | 41 | } 42 | -------------------------------------------------------------------------------- /spf4j-avro-components/spf4j-avro/src/main/java/org/apache/calcite/interpreter/Spf4jDataContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 SPF4J. 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 | package org.apache.calcite.interpreter; 17 | 18 | import org.apache.calcite.DataContext; 19 | 20 | /** 21 | * 22 | * @author Zoltan Farkas 23 | */ 24 | public final class Spf4jDataContext extends Context { 25 | 26 | public Spf4jDataContext(final DataContext root) { 27 | super(root); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /spf4j-avro-components/spf4j-avro/src/main/java/org/spf4j/avro/DecodedSchema.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 SPF4J. 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 | package org.spf4j.avro; 17 | 18 | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 19 | import javax.annotation.ParametersAreNonnullByDefault; 20 | import org.apache.avro.Schema; 21 | import org.apache.avro.io.Decoder; 22 | 23 | /** 24 | * @author Zoltan Farkas 25 | */ 26 | @ParametersAreNonnullByDefault 27 | public final class DecodedSchema { 28 | 29 | private final Schema schema; 30 | 31 | private final Decoder decoder; 32 | 33 | @SuppressFBWarnings("EI_EXPOSE_REP2") 34 | public DecodedSchema(final Schema schema, final Decoder decoder) { 35 | this.schema = schema; 36 | this.decoder = decoder; 37 | } 38 | 39 | @SuppressFBWarnings("EI_EXPOSE_REP") 40 | public Schema getSchema() { 41 | return schema; 42 | } 43 | 44 | public Decoder getDecoder() { 45 | return decoder; 46 | } 47 | 48 | @Override 49 | public String toString() { 50 | return "DecodedSchema{" + "schema=" + schema + ", decoder=" + decoder + '}'; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /spf4j-avro-components/spf4j-avro/src/main/java/org/spf4j/avro/SqlPredicate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 SPF4J. 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 | package org.spf4j.avro; 17 | 18 | import java.util.function.Predicate; 19 | import org.apache.avro.generic.IndexedRecord; 20 | 21 | /** 22 | * A predicate represented by a SQL Expression. 23 | * @author Zoltan Farkas 24 | */ 25 | public interface SqlPredicate extends Predicate { 26 | 27 | String getSqlString(); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /spf4j-avro-components/spf4j-avro/src/main/java/org/spf4j/avro/calcite/AvroSupplier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 SPF4J. 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 | package org.spf4j.avro.calcite; 17 | 18 | import java.util.List; 19 | import org.apache.avro.generic.IndexedRecord; 20 | import org.spf4j.base.CloseableIterator; 21 | 22 | /** 23 | * @author Zoltan Farkas 24 | */ 25 | public interface AvroSupplier { 26 | 27 | CloseableIterator get(List filters, List projections); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /spf4j-avro-components/spf4j-avro/src/main/java/org/spf4j/avro/calcite/FilteredProjectedSupplier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 SPF4J. 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 | package org.spf4j.avro.calcite; 17 | 18 | /** 19 | * @author Zoltan Farkas 20 | */ 21 | public interface FilteredProjectedSupplier { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /spf4j-avro-components/spf4j-avro/src/main/java/org/spf4j/avro/calcite/PlannerUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 SPF4J. 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 | package org.spf4j.avro.calcite; 17 | 18 | import org.apache.calcite.plan.hep.HepPlanner; 19 | import org.apache.calcite.plan.hep.HepProgram; 20 | import org.apache.calcite.plan.hep.HepProgramBuilder; 21 | import org.apache.calcite.rel.RelNode; 22 | import org.apache.calcite.rel.rules.CoreRules; 23 | 24 | /** 25 | * 26 | * @author Zoltan Farkas 27 | */ 28 | public final class PlannerUtils { 29 | 30 | private PlannerUtils() { } 31 | 32 | public static RelNode pushDownPredicatesAndProjection(final RelNode rootRel) { 33 | final HepProgram hepProgram = new HepProgramBuilder() 34 | //push down predicates 35 | .addRuleInstance(CoreRules.FILTER_INTO_JOIN) 36 | //push down projections 37 | .addRuleInstance(CoreRules.PROJECT_JOIN_TRANSPOSE) 38 | .addRuleInstance(CoreRules.FILTER_PROJECT_TRANSPOSE) 39 | .build(); 40 | final HepPlanner planner = new HepPlanner(hepProgram); 41 | planner.setRoot(rootRel); 42 | return planner.findBestExp(); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /spf4j-avro-components/spf4j-avro/src/main/java/org/spf4j/avro/calcite/TableAccessDeniedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 SPF4J. 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 | package org.spf4j.avro.calcite; 17 | 18 | public final class TableAccessDeniedException extends RuntimeException { 19 | 20 | private static final long serialVersionUID = 1L; 21 | 22 | public TableAccessDeniedException() { 23 | } 24 | 25 | public TableAccessDeniedException(final String msg) { 26 | super(msg); 27 | } 28 | 29 | public TableAccessDeniedException(final String msg, final Throwable t) { 30 | super(msg, t); 31 | } 32 | 33 | public TableAccessDeniedException(final Throwable t) { 34 | super(t); 35 | } 36 | 37 | 38 | } 39 | -------------------------------------------------------------------------------- /spf4j-avro-components/spf4j-avro/src/main/resources/org/spf4j/avro/enum.vm: -------------------------------------------------------------------------------- 1 | ## 2 | ## Licensed to the Apache Software Foundation (ASF) under one 3 | ## or more contributor license agreements. See the NOTICE file 4 | ## distributed with this work for additional information 5 | ## regarding copyright ownership. The ASF licenses this file 6 | ## to you under the Apache License, Version 2.0 (the 7 | ## "License"); you may not use this file except in compliance 8 | ## with the License. You may obtain a copy of the License at 9 | ## 10 | ## http://www.apache.org/licenses/LICENSE-2.0 11 | ## 12 | ## Unless required by applicable law or agreed to in writing, software 13 | ## distributed under the License is distributed on an "AS IS" BASIS, 14 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | ## See the License for the specific language governing permissions and 16 | ## limitations under the License. 17 | ## 18 | #if ($schema.getNamespace()) 19 | package $schema.getNamespace(); 20 | #end 21 | @SuppressWarnings("all") 22 | #if ($schema.getDoc()) 23 | /** $schema.getDoc() */ 24 | #end 25 | #foreach ($annotation in $this.javaAnnotations($schema)) 26 | @$annotation 27 | #end 28 | @org.apache.avro.specific.AvroGenerated 29 | public enum ${this.mangle($schema.getName())} implements org.apache.avro.generic.GenericEnumSymbol { 30 | #foreach ($symbol in ${schema.getEnumSymbols()})${this.mangle($symbol)}#if ($velocityHasNext), #end#end 31 | ; 32 | public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("${this.javaEscape($schema.toString())}"); 33 | public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; } 34 | public org.apache.avro.Schema getSchema() { return SCHEMA$; } 35 | } 36 | -------------------------------------------------------------------------------- /spf4j-config-discovery-maven-plugin/src/it/simple-it/verify.groovy: -------------------------------------------------------------------------------- 1 | File avdlFile = new File( basedir, "target/generated-sources/avdl/simple-it.avdl" ); 2 | 3 | assert avdlFile.isFile() 4 | -------------------------------------------------------------------------------- /spf4j-core-gwt/src/main/resources/org/spf4j/ForceSpf4jCompilation.gwt.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /spf4j-core-gwt/src/main/resources/org/spf4j/ForceSpf4jCompilationEntryPoint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | * 18 | * Additionally licensed with: 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | package org.spf4j; 33 | 34 | import com.google.gwt.core.client.EntryPoint; 35 | 36 | public class ForceSpf4jCompilationEntryPoint implements EntryPoint { 37 | @Override public void onModuleLoad() { 38 | //dummy entry point to convince Maven to compile 39 | } 40 | } -------------------------------------------------------------------------------- /spf4j-core-gwt/src/main/resources/org/spf4j/base/Base.gwt.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/base/ArrayWriter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 SPF4J. 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 | package org.spf4j.base; 17 | 18 | import java.io.Closeable; 19 | import java.io.Flushable; 20 | import java.io.IOException; 21 | import java.io.UncheckedIOException; 22 | import java.util.function.Consumer; 23 | 24 | /** 25 | * @author Zoltan Farkas 26 | */ 27 | @FunctionalInterface 28 | public interface ArrayWriter extends Flushable, Closeable, Consumer { 29 | 30 | void write(T t) throws IOException; 31 | 32 | default void accept(final T t) { 33 | try { 34 | write(t); 35 | } catch (IOException ex) { 36 | throw new UncheckedIOException(ex); 37 | } 38 | } 39 | 40 | default void close() throws IOException { 41 | // no close default 42 | } 43 | 44 | default void flush() throws IOException { 45 | // no flush default 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/base/CharArrayConsumer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 SPF4J. 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 | package org.spf4j.base; 17 | 18 | /** 19 | * @author Zoltan Farkas 20 | */ 21 | public interface CharArrayConsumer { 22 | void accept(char[] array, int offset, int length); 23 | } 24 | -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/base/ESupplier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | * 18 | * Additionally licensed with: 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | package org.spf4j.base; 33 | 34 | /** 35 | * 36 | * @author Zoltan Farkas 37 | */ 38 | @FunctionalInterface 39 | public interface ESupplier { 40 | 41 | T get() throws E; 42 | 43 | } 44 | -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/base/Handler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | * 18 | * Additionally licensed with: 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | package org.spf4j.base; 33 | 34 | /** 35 | * 36 | * @author zoly 37 | */ 38 | public interface Handler { 39 | 40 | // CHECKSTYLE:OFF -- checkstyle does not seem to handle generic exceptions 41 | void handle(T object, long deadlineMillis) throws E; 42 | // CHECKSTYLE:ON 43 | 44 | } 45 | -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/base/HandlerNano.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | * 18 | * Additionally licensed with: 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | package org.spf4j.base; 33 | 34 | /** 35 | * 36 | * @author zoly 37 | */ 38 | public interface HandlerNano { 39 | 40 | R handle(T object, long deadlineNanos) throws E; 41 | 42 | } 43 | -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/base/IntSequence.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | * 18 | * Additionally licensed with: 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | package org.spf4j.base; 33 | 34 | /** 35 | * @author zoly 36 | */ 37 | public interface IntSequence { 38 | int nextInt(); 39 | } 40 | -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/base/Invocation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | * 18 | * Additionally licensed with: 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | package org.spf4j.base; 33 | 34 | /** 35 | * @author Zoltan Farkas 36 | */ 37 | public interface Invocation { 38 | 39 | Object invoke(Object... parameters) throws Exception; 40 | } 41 | -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/base/JsonReader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | * 18 | * Additionally licensed with: 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | package org.spf4j.base; 33 | 34 | import java.io.Reader; 35 | 36 | /** 37 | * @author Zoltan Farkas 38 | */ 39 | public interface JsonReader { 40 | T readFrom(Reader r); 41 | } 42 | -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/base/MapWriter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 SPF4J. 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 | package org.spf4j.base; 17 | 18 | import java.io.Flushable; 19 | import java.util.function.BiConsumer; 20 | 21 | /** 22 | * @author Zoltan Farkas 23 | */ 24 | public interface MapWriter extends Flushable, BiConsumer { 25 | 26 | } 27 | -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/base/ParameterizedSupplier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | * 18 | * Additionally licensed with: 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | package org.spf4j.base; 33 | 34 | /** 35 | * 36 | * @author zoly 37 | */ 38 | public interface ParameterizedSupplier { 39 | 40 | W get(PT parameter); 41 | 42 | } 43 | -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/base/SuppressedThrowable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | * 18 | * Additionally licensed with: 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | package org.spf4j.base; 33 | 34 | public final class SuppressedThrowable extends Throwable { 35 | 36 | public SuppressedThrowable(final Throwable t) { 37 | super(t); 38 | } 39 | 40 | @Override 41 | public Throwable fillInStackTrace() { 42 | return this; 43 | } 44 | 45 | 46 | 47 | } 48 | -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/base/avro/AvroContainer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 SPF4J. 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 | package org.spf4j.base.avro; 17 | 18 | import javax.annotation.Nullable; 19 | import org.apache.avro.Schema; 20 | 21 | /** 22 | * @author Zoltan Farkas 23 | */ 24 | public interface AvroContainer { 25 | 26 | /** 27 | * return the element schema of the container. 28 | * @return null if schema can be inferred from type. 29 | */ 30 | @Nullable 31 | default Schema getElementSchema() { 32 | return null; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/base/avro/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | * 18 | * Additionally licensed with: 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | @edu.umd.cs.findbugs.annotations.SuppressFBWarnings 33 | package org.spf4j.base.avro; 34 | -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/concurrent/Sequence.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | * 18 | * Additionally licensed with: 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | package org.spf4j.concurrent; 33 | 34 | public interface Sequence { 35 | 36 | /** 37 | * @return next number in sequence. if result is negative an overflow happened. 38 | */ 39 | long next(); 40 | 41 | } 42 | -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/ds/LinkedMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | * 18 | * Additionally licensed with: 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | package org.spf4j.ds; 33 | 34 | import java.util.Map; 35 | import javax.annotation.Nullable; 36 | 37 | /** 38 | * 39 | * @author zoly 40 | */ 41 | public interface LinkedMap extends Map { 42 | 43 | @Nullable 44 | Map.Entry getLastEntry(); 45 | 46 | @Nullable 47 | Map.Entry pollLastEntry(); 48 | 49 | } 50 | -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/ds/LinkedSet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | * 18 | * Additionally licensed with: 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | package org.spf4j.ds; 33 | 34 | import java.util.Set; 35 | import javax.annotation.Nullable; 36 | 37 | /** 38 | * 39 | * @author zoly 40 | */ 41 | public interface LinkedSet extends Set { 42 | 43 | @Nullable 44 | V getLastValue(); 45 | 46 | @Nullable 47 | V pollLastValue(); 48 | 49 | } 50 | -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/failsafe/PartialExceptionRetryPredicate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 SPF4J. 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 | package org.spf4j.failsafe; 17 | 18 | import java.util.concurrent.Callable; 19 | 20 | /** 21 | * Chain-able Exception predicate. 22 | * This predicate will not return a RetryDecision (null) when if want to deffer the retry decision. 23 | * @author Zoltan Farkas 24 | */ 25 | @FunctionalInterface 26 | public interface PartialExceptionRetryPredicate> 27 | extends PartialTypedExceptionRetryPredicate { 28 | 29 | } 30 | -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/failsafe/PartialResultRetryPredicate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 SPF4J. 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 | package org.spf4j.failsafe; 17 | 18 | import java.util.concurrent.Callable; 19 | import java.util.function.BiFunction; 20 | import javax.annotation.Nonnull; 21 | import javax.annotation.Nullable; 22 | 23 | /** 24 | * Chainable Result predicate. 25 | * This predicate will not return a RetryDecision (null) when if want to deffer the retry decision. 26 | * @author Zoltan Farkas 27 | */ 28 | @FunctionalInterface 29 | public interface PartialResultRetryPredicate> 30 | extends BiFunction> { 31 | 32 | @Nullable 33 | RetryDecision getDecision(@Nonnull T value, @Nonnull C what); 34 | 35 | @Override 36 | @Nullable 37 | default RetryDecision apply(final T t, final C u) { 38 | return getDecision(t, u); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/failsafe/RetryDelaySupplier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 SPF4J. 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 | package org.spf4j.failsafe; 17 | 18 | import java.util.function.LongSupplier; 19 | 20 | /** 21 | * @author Zoltan Farkas 22 | */ 23 | public interface RetryDelaySupplier 24 | extends LongSupplier { 25 | 26 | long nextDelay(); 27 | 28 | @Override 29 | default long getAsLong() { 30 | return nextDelay(); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/failsafe/TimedSupplier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 SPF4J. 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 | package org.spf4j.failsafe; 17 | 18 | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 19 | import java.util.function.Supplier; 20 | 21 | /** 22 | * @author Zoltan Farkas 23 | */ 24 | @FunctionalInterface 25 | public interface TimedSupplier { 26 | 27 | T get(long startTimeNanos, long deadlineNanos); 28 | 29 | static TimedSupplier constant(T value) { 30 | return new TimedSupplier() { 31 | @Override 32 | public T get(final long startTimeNanos, final long deadlineNanos) { 33 | return value; 34 | } 35 | 36 | @Override 37 | public String toString() { 38 | return "ConstTimedSupplier{" + value + '}'; 39 | } 40 | }; 41 | } 42 | 43 | @SuppressFBWarnings("FII_USE_METHOD_REFERENCE") 44 | static TimedSupplier fromSupplier(Supplier supplier) { 45 | return (s, e) -> supplier.get(); 46 | } 47 | 48 | 49 | } 50 | -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/failsafe/concurrent/ConditionalConsumer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | * 18 | * Additionally licensed with: 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | package org.spf4j.failsafe.concurrent; 33 | 34 | /** 35 | * 36 | * @author Zoltan Farkas 37 | */ 38 | public interface ConditionalConsumer { 39 | 40 | boolean accept(T what); 41 | 42 | } 43 | -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/failsafe/concurrent/DefaultFailSafeExecutor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 SPF4J. 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 | package org.spf4j.failsafe.concurrent; 17 | 18 | import org.spf4j.base.ShutdownThread; 19 | import org.spf4j.concurrent.DefaultExecutor; 20 | 21 | /** 22 | * a default Retry executor. 23 | * @author Zoltan Farkas 24 | */ 25 | public final class DefaultFailSafeExecutor { 26 | 27 | private DefaultFailSafeExecutor() { } 28 | 29 | private static final FailSafeExecutorImpl R_EXEC = new FailSafeExecutorImpl(DefaultExecutor.get()); 30 | 31 | static { 32 | if (!ShutdownThread.get().queueHook(DefaultExecutor.getShutDownOrder() - 1, () -> { 33 | R_EXEC.initiateClose(); 34 | })) { 35 | R_EXEC.initiateClose(); 36 | } 37 | } 38 | 39 | /** 40 | * @deprecated use get. 41 | */ 42 | @Deprecated 43 | public static FailSafeExecutorImpl instance() { 44 | return R_EXEC; 45 | } 46 | 47 | public static FailSafeExecutorImpl get() { 48 | return R_EXEC; 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/failsafe/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This package contains operation retry utilities. 3 | * 4 | * Why yet another package? 5 | * 6 | * 1) No Exception lost + ability to propagate checked exceptions (Sync mode only). 7 | * 2) Retry operation can be different from original operation. (redirect, fallback, etc...) 8 | * 3) The retry operation can be executed with delay which can be a function of the response or exception. 9 | * 4) Timeouts are core functionality. 10 | * 11 | */ 12 | package org.spf4j.failsafe; 13 | -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/io/FSWatchEventSensitivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | * 18 | * Additionally licensed with: 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | package org.spf4j.io; 33 | 34 | /** 35 | * 36 | * @author zoly 37 | */ 38 | public enum FSWatchEventSensitivity { 39 | HIGH, MEDIUM, LOW 40 | } 41 | -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/io/csv/CsvMapHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | * 18 | * Additionally licensed with: 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | package org.spf4j.io.csv; 33 | 34 | import java.util.Map; 35 | 36 | /** 37 | * 38 | * @author zoly 39 | */ 40 | public interface CsvMapHandler { 41 | 42 | void row(Map row); 43 | 44 | T eof(); 45 | } 46 | -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/io/csv/CsvRowHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | * 18 | * Additionally licensed with: 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | package org.spf4j.io.csv; 33 | 34 | /** 35 | * 36 | * @author zoly 37 | */ 38 | public interface CsvRowHandler { 39 | 40 | void element(CharSequence elem); 41 | 42 | T eof(); 43 | 44 | } 45 | -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/io/csv/ElementAppendable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | * 18 | * Additionally licensed with: 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | package org.spf4j.io.csv; 33 | 34 | import java.io.Closeable; 35 | 36 | /** 37 | * 38 | * @author Zoltan Farkas 39 | */ 40 | public interface ElementAppendable extends Appendable, Closeable { 41 | 42 | } 43 | -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/io/tcp/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | * 18 | * Additionally licensed with: 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | package org.spf4j.io.tcp; 33 | -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/io/tcp/proxy/SnifferFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | * 18 | * Additionally licensed with: 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | package org.spf4j.io.tcp.proxy; 33 | 34 | import java.nio.channels.SocketChannel; 35 | 36 | /** 37 | * 38 | * @author zoly 39 | */ 40 | public interface SnifferFactory { 41 | 42 | Sniffer get(SocketChannel channel); 43 | 44 | } 45 | -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/perf/CloseableMeasurementRecorder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | * 18 | * Additionally licensed with: 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | package org.spf4j.perf; 33 | 34 | /** 35 | * 36 | * @author Zoltan Farkas 37 | */ 38 | public interface CloseableMeasurementRecorder extends MeasurementRecorder, AutoCloseable { 39 | @Override 40 | void close(); 41 | } 42 | -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/perf/CloseableMeasurementRecorderSource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | * 18 | * Additionally licensed with: 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | package org.spf4j.perf; 33 | 34 | /** 35 | * @author Zoltan Farkas 36 | */ 37 | public interface CloseableMeasurementRecorderSource extends MeasurementRecorderSource, AutoCloseable { 38 | @Override 39 | void close(); 40 | } 41 | -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/perf/JmxSupport.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | * 18 | * Additionally licensed with: 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | package org.spf4j.perf; 33 | 34 | import java.io.Closeable; 35 | 36 | /** 37 | * a java object that exposes JMX attributes and operations. 38 | * @author Zoltan Farkas 39 | */ 40 | public interface JmxSupport extends Closeable { 41 | 42 | void registerJmx(); 43 | 44 | void close(); 45 | 46 | } 47 | -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/perf/MeasurementsSource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | * 18 | * Additionally licensed with: 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | package org.spf4j.perf; 33 | 34 | import java.util.Map; 35 | 36 | /** 37 | * 38 | * @author zoly 39 | */ 40 | public interface MeasurementsSource { 41 | 42 | Map getEntitiesMeasurements(); 43 | 44 | Map getEntitiesMeasurementsAndReset(); 45 | 46 | } 47 | -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/perf/MultiMeasurementRecorder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | * 18 | * Additionally licensed with: 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | package org.spf4j.perf; 33 | 34 | /** 35 | * 36 | * @author zoly 37 | */ 38 | public interface MultiMeasurementRecorder { 39 | 40 | void record(long... measurement); 41 | 42 | void recordAt(long timestampMillis, long... measurement); 43 | 44 | } 45 | -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/recyclable/Lease.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | * 18 | * Additionally licensed with: 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | package org.spf4j.recyclable; 33 | 34 | import java.util.function.Supplier; 35 | 36 | 37 | /** 38 | * 39 | * @author zoly 40 | */ 41 | public interface Lease extends Supplier, AutoCloseable { 42 | 43 | } -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/recyclable/LeaseSupplier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | * 18 | * Additionally licensed with: 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | package org.spf4j.recyclable; 33 | 34 | import java.util.function.Supplier; 35 | 36 | 37 | public interface LeaseSupplier extends Supplier> { 38 | 39 | } 40 | -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/recyclable/SizedLeaseSupplier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | * 18 | * Additionally licensed with: 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | package org.spf4j.recyclable; 33 | 34 | /** 35 | * 36 | * @author zoly 37 | */ 38 | public interface SizedLeaseSupplier { 39 | 40 | Lease lease(int size); 41 | 42 | } 43 | -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/recyclable/UsageProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | * 18 | * Additionally licensed with: 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | package org.spf4j.recyclable; 33 | 34 | /** 35 | * 36 | * @author zoly 37 | */ 38 | public interface UsageProvider { 39 | 40 | long getUsage(T object); 41 | 42 | } 43 | -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/recyclable/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | * 18 | * Additionally licensed with: 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | @SuppressFBWarnings("MDM_WAIT_WITHOUT_TIMEOUT") 33 | package org.spf4j.recyclable; 34 | 35 | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 36 | 37 | -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/reflect/ByTypeSupplier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | * 18 | * Additionally licensed with: 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | package org.spf4j.reflect; 33 | 34 | import java.lang.reflect.Type; 35 | import javax.annotation.Nullable; 36 | 37 | /** 38 | * @author Zoltan Farkas 39 | */ 40 | public interface ByTypeSupplier { 41 | @Nullable 42 | T get(Type type) throws E; 43 | } 44 | -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/security/EncryptorDecryptor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | * 18 | * Additionally licensed with: 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | package org.spf4j.security; 33 | 34 | import java.security.GeneralSecurityException; 35 | 36 | public interface EncryptorDecryptor { 37 | 38 | byte[] decrypt(byte[] bytes) throws GeneralSecurityException; 39 | 40 | byte[] encrypt(byte[] bytes); 41 | } 42 | -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/ssdump2/avro/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | * 18 | * Additionally licensed with: 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | @edu.umd.cs.findbugs.annotations.SuppressFBWarnings 33 | package org.spf4j.ssdump2.avro; 34 | -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/stackmonitor/ProfileMetaData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 SPF4J. 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 | package org.spf4j.stackmonitor; 17 | 18 | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 19 | import java.util.Collection; 20 | import java.util.Collections; 21 | import java.util.HashSet; 22 | import java.util.Set; 23 | 24 | /** 25 | * 26 | * @author Zoltan Farkas 27 | */ 28 | @SuppressFBWarnings("EI_EXPOSE_REP") //not true 29 | public final class ProfileMetaData { 30 | 31 | private final Set contexts; 32 | 33 | private final Set tags; 34 | 35 | public ProfileMetaData(final Collection contexts, final Collection tags) { 36 | this.contexts = Collections.unmodifiableSet(new HashSet<>(contexts)); 37 | this.tags = Collections.unmodifiableSet(new HashSet<>(tags)); 38 | } 39 | 40 | public Set getContexts() { 41 | return contexts; 42 | } 43 | 44 | public Set getTags() { 45 | return tags; 46 | } 47 | 48 | @Override 49 | public String toString() { 50 | return "ProfileMetaData{" + "contexts=" + contexts + ", tags=" + tags + '}'; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/stackmonitor/SamplerSupplier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | * 18 | * Additionally licensed with: 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | package org.spf4j.stackmonitor; 33 | 34 | /** 35 | * @author Zoltan Farkas 36 | */ 37 | public interface SamplerSupplier { 38 | 39 | ISampler get(Thread samplingThread); 40 | 41 | } 42 | -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/stackmonitor/StackSampleSupplier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 SPF4J. 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 | package org.spf4j.stackmonitor; 17 | 18 | import java.io.IOException; 19 | import java.time.Instant; 20 | import javax.annotation.Nullable; 21 | 22 | /** 23 | * A basic abstraction for a stack sample source. 24 | * @author Zoltan Farkas 25 | */ 26 | public interface StackSampleSupplier { 27 | 28 | Instant getMin() throws IOException; 29 | 30 | Instant getMax() throws IOException; 31 | 32 | ProfileMetaData getMetaData(Instant from, Instant to) throws IOException; 33 | 34 | @Nullable 35 | SampleNode getSamples(@Nullable String context, @Nullable String tag, 36 | Instant from, Instant to) throws IOException; 37 | 38 | } 39 | -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/text/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | * 18 | * Additionally licensed with: 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | package org.spf4j.text; 33 | -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/trace/avro/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | * 18 | * Additionally licensed with: 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | @edu.umd.cs.findbugs.annotations.SuppressFBWarnings 33 | package org.spf4j.trace.avro; 34 | -------------------------------------------------------------------------------- /spf4j-core/src/main/java/org/spf4j/tsdb2/avro/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | * 18 | * Additionally licensed with: 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | @SuppressFBWarnings 33 | package org.spf4j.tsdb2.avro; 34 | 35 | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 36 | 37 | -------------------------------------------------------------------------------- /spf4j-core/src/site/site.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | SPF4J CORE 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | org.apache.maven.skins 20 | maven-fluido-skin 21 | 1.7 22 | 23 | 24 | 25 | false 26 | true 27 | width: 90%; 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /spf4j-core/src/test/java/org/spf4j/base/TimeSourceTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 SPF4J. 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 | package org.spf4j.base; 17 | 18 | import java.util.concurrent.TimeUnit; 19 | import org.junit.Assert; 20 | import org.junit.Test; 21 | 22 | /** 23 | * @author Zoltan Farkas 24 | */ 25 | public class TimeSourceTest { 26 | 27 | 28 | @Test 29 | public void testTimeout() { 30 | long nano1 = TimeSource.nanoTime(); 31 | long nano2 = TimeSource.nanoTime(); 32 | long deadline = nano1 + Long.MAX_VALUE; 33 | Assert.assertTrue(nano2 - nano1 >= 0); 34 | Assert.assertEquals(Long.MAX_VALUE, deadline - nano1); 35 | 36 | long deadlineNanos = TimeSource.getDeadlineNanos(Long.MAX_VALUE, TimeUnit.MINUTES); 37 | long time2 = deadlineNanos - TimeSource.nanoTime(); 38 | Assert.assertTrue("Time must be non-zero positive " + time2, time2 > 0); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /spf4j-core/src/test/java/org/spf4j/failsafe/Request.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 SPF4J. 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 | package org.spf4j.failsafe; 17 | 18 | /** 19 | * 20 | * @author Zoltan Farkas 21 | */ 22 | public final class Request { 23 | 24 | private final String url; 25 | 26 | private final long deadlineMSEpoch; 27 | 28 | 29 | public Request(final String url, final long deadlineMSEpoch) { 30 | this.url = url; 31 | this.deadlineMSEpoch = deadlineMSEpoch; 32 | } 33 | 34 | public String getUrl() { 35 | return url; 36 | } 37 | 38 | public long getDeadlineMSEpoch() { 39 | return deadlineMSEpoch; 40 | } 41 | 42 | @Override 43 | public String toString() { 44 | return "Request{" + "url=" + url + ", deadlineMSEpoch=" + deadlineMSEpoch + '}'; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /spf4j-core/src/test/java/org/spf4j/jmx/PropertySource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | * 18 | * Additionally licensed with: 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | package org.spf4j.jmx; 33 | 34 | /** 35 | * 36 | * @author zoly 37 | */ 38 | public abstract class PropertySource { 39 | 40 | public abstract Object getProperty(String name); 41 | 42 | 43 | public abstract void setProperty(String name, String value); 44 | 45 | } 46 | -------------------------------------------------------------------------------- /spf4j-core/src/test/java/org/spf4j/jmx/TestEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | * 18 | * Additionally licensed with: 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | package org.spf4j.jmx; 33 | 34 | /** 35 | * 36 | * @author zoly 37 | */ 38 | public enum TestEnum { 39 | VAL1, VAL2 40 | } 41 | -------------------------------------------------------------------------------- /spf4j-core/src/test/java/org/spf4j/jmx/TestMXBean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | * 18 | * Additionally licensed with: 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | package org.spf4j.jmx; 33 | 34 | /** 35 | * 36 | * @author zoly 37 | */ 38 | public interface TestMXBean { 39 | 40 | String[] getArray(); 41 | 42 | String[][] getMatrix(); 43 | 44 | TestEnum getEnum(); 45 | 46 | String getStuff(); 47 | 48 | } 49 | -------------------------------------------------------------------------------- /spf4j-core/src/test/java/org/spf4j/test/package-info.java: -------------------------------------------------------------------------------- 1 | @edu.umd.cs.findbugs.annotations.SuppressFBWarnings 2 | package org.spf4j.test; 3 | -------------------------------------------------------------------------------- /spf4j-core/src/test/resources/heartBeats.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE HEARTBEATS ( 2 | OWNER VARCHAR(255) NOT NULL PRIMARY KEY, 3 | INTERVAL_MILLIS bigint NOT NULL, 4 | LAST_HEARTBEAT_INSTANT_MILLIS bigint NOT NULL 5 | ); 6 | -------------------------------------------------------------------------------- /spf4j-core/src/test/resources/semaphoreTable.sql: -------------------------------------------------------------------------------- 1 | 2 | CREATE TABLE SEMAPHORES ( 3 | SEMAPHORE_NAME VARCHAR(255) NOT NULL PRIMARY KEY, 4 | AVAILABLE_PERMITS BIGINT NOT NULL, 5 | TOTAL_PERMITS BIGINT NOT NULL, 6 | LAST_UPDATED_BY VARCHAR(255) NOT NULL, 7 | LAST_UPDATED_AT BIGINT NOT NULL 8 | ); 9 | 10 | CREATE TABLE PERMITS_BY_OWNER ( 11 | SEMAPHORE_NAME VARCHAR(255) NOT NULL, 12 | OWNER VARCHAR(255) NOT NULL, 13 | PERMITS BIGINT NOT NULL, 14 | LAST_UPDATED_AT BIGINT NOT NULL, 15 | PRIMARY KEY (SEMAPHORE_NAME, OWNER), 16 | FOREIGN KEY (SEMAPHORE_NAME) REFERENCES SEMAPHORES(SEMAPHORE_NAME) 17 | ); 18 | -------------------------------------------------------------------------------- /spf4j-core/src/test/resources/test.csv: -------------------------------------------------------------------------------- 1 | a,b,c 2 | 1,2,3 3 | 2,3, 4 | "3,, 5 | asdg,,ahsd 6 | sdf",f, -------------------------------------------------------------------------------- /spf4j-core/src/test/resources/test.ssdump3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zolyfarkas/spf4j/93154e244d8ea161523e5cba4022be9abe48f231/spf4j-core/src/test/resources/test.ssdump3 -------------------------------------------------------------------------------- /spf4j-core/src/test/resources/test_bad.csv: -------------------------------------------------------------------------------- 1 | a,b,c 2 | 1,2,3 3 | 2,3, 4 | "3,, 5 | asdg,,ah""sd 6 | sdf,f, -------------------------------------------------------------------------------- /spf4j-jdiff-maven-plugin/src/main/java/org/spf4j/jdiff/JavadocExecutionException.java: -------------------------------------------------------------------------------- 1 | package org.spf4j.jdiff; 2 | 3 | /* 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | /** 22 | * Exception to throw when the javadoc execution fails 23 | */ 24 | public class JavadocExecutionException 25 | extends Exception { 26 | 27 | /** 28 | * serial version UID. 29 | */ 30 | private static final long serialVersionUID = 1L; 31 | 32 | public JavadocExecutionException(final String message) { 33 | super(message); 34 | } 35 | 36 | public JavadocExecutionException(final String message, final Throwable cause) { 37 | super(message, cause); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /spf4j-jdiff-maven-plugin/src/main/java/org/spf4j/jdiff/package-info.java: -------------------------------------------------------------------------------- 1 | @SuppressFBWarnings("PATH_TRAVERSAL_IN")//inputs not designed for external entry 2 | package org.spf4j.jdiff; 3 | 4 | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 5 | 6 | -------------------------------------------------------------------------------- /spf4j-jdiff-maven-plugin/src/test/java/org/spf4j/jdiff/JDiffRunnerTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 SPF4J. 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 | package org.spf4j.jdiff; 17 | 18 | 19 | import java.io.IOException; 20 | import java.io.File; 21 | import org.eclipse.aether.resolution.ArtifactResolutionException; 22 | import org.eclipse.aether.resolution.DependencyResolutionException; 23 | import org.eclipse.aether.resolution.VersionRangeResolutionException; 24 | import org.junit.Assert; 25 | import org.junit.Test; 26 | 27 | /** 28 | * @author Zoltan Farkas 29 | */ 30 | public class JDiffRunnerTest { 31 | 32 | @Test 33 | public void testJDiff() throws VersionRangeResolutionException, 34 | ArtifactResolutionException, DependencyResolutionException, JavadocExecutionException, IOException { 35 | JDiffRunner jDiffRunner = new JDiffRunner(); 36 | File destination = new File("target/jdiff"); 37 | jDiffRunner.runDiffBetweenReleases("org.spf4j", "spf4j-core", "[8.4.0,8.4.4]", destination, 10); 38 | jDiffRunner.writeChangesIndexHtml(destination, "changes.html"); 39 | Assert.assertTrue(new File(destination, "changes.html").exists()); 40 | } 41 | 42 | 43 | } 44 | -------------------------------------------------------------------------------- /spf4j-jmh-11/src/main/java/org/spf4j/stackmonitor/RecordingGranularity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 SPF4J. 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 | package org.spf4j.stackmonitor; 17 | 18 | /** 19 | * Enum to determinate benchmark recording granularity. 20 | * 21 | * @author Zoltan Farkas 22 | */ 23 | public enum RecordingGranularity { 24 | PER_ITERATION, PER_ITERATION_TYPE 25 | 26 | } 27 | -------------------------------------------------------------------------------- /spf4j-junit/src/site/markdown/index.md: -------------------------------------------------------------------------------- 1 | ## spf4j-junit the module that allows to profile your unit tests. 2 | 3 | To enable the spf4j profilling, you will need to configure your maven-surefire-plugin to run the spf4j run listener: 4 | 5 | 6 | org.apache.maven.plugins 7 | maven-surefire-plugin 8 | 9 | 10 | 11 | listener 12 | org.spf4j.junit.Spf4jRunListener 13 | 14 | 15 | spf4j.junit.sampleTimeMillis 16 | 10 17 | 18 | 19 | 20 | 21 | 22 | and add spf4j-junit to your test classpath: 23 | 24 | 25 | org.spf4j 26 | spf4j-junit 27 | ${spf4j.version} 28 | test 29 | 30 | 31 | after which by default your ssdump2 profiles will be available in /target/junit-ssdump. 32 | (you can inspect them with spf4j-ui) -------------------------------------------------------------------------------- /spf4j-junit/src/site/site.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | SPF4J 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | org.apache.maven.skins 20 | maven-fluido-skin 21 | 1.7 22 | 23 | 24 | 25 | false 26 | true 27 | width: 90%; 28 | 29 | 30 | -------------------------------------------------------------------------------- /spf4j-maven-schema-resolver/src/main/java/org/spf4j/maven/Registerer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 SPF4J. 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 | package org.spf4j.maven; 17 | 18 | import java.util.List; 19 | import org.eclipse.aether.RepositorySystem; 20 | import org.eclipse.aether.RepositorySystemSession; 21 | import org.eclipse.aether.repository.RemoteRepository; 22 | 23 | /** 24 | * 25 | * @author Zoltan Farkas 26 | */ 27 | public final class Registerer { 28 | 29 | private Registerer() { } 30 | 31 | public static void register(final RepositorySystem repoSystem, final RepositorySystemSession repoSystemSession, 32 | final List remotes, final String classifier, final String extension) { 33 | new MavenSchemaResolver(repoSystem, repoSystemSession, remotes, classifier, extension).registerAsDefault(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /spf4j-maven-schema-resolver/src/test/java/org/spf4j/maven/MavenSchemaResolverTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 SPF4J. 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 | package org.spf4j.maven; 17 | 18 | import java.io.File; 19 | import java.util.Collections; 20 | import org.apache.avro.Schema; 21 | import org.eclipse.aether.repository.RemoteRepository; 22 | import org.junit.Assert; 23 | import org.junit.Test; 24 | 25 | /** 26 | * @author Zoltan Farkas 27 | */ 28 | public class MavenSchemaResolverTest { 29 | 30 | @Test 31 | public void testSchemaResolution() { 32 | File localRepo = new File(System.getProperty("user.home"), ".m2/repository"); 33 | RemoteRepository bintray = new RemoteRepository.Builder("central", "default", 34 | "https://repo1.maven.org/maven2") 35 | .build(); 36 | 37 | MavenSchemaResolver resolver = new MavenSchemaResolver(Collections.singletonList(bintray), 38 | localRepo, null, "jar"); 39 | 40 | String mvnId = "org.spf4j.avro:core-schema:1.0.3:6"; 41 | 42 | Schema resolveSchema = resolver.resolveSchema(mvnId); 43 | Assert.assertEquals("FileLocation", resolveSchema.getName()); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /spf4j-slf4j-test/src/main/java/org/spf4j/test/log/AllLevelsLogHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 SPF4J. 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 | package org.spf4j.test.log; 17 | 18 | import org.spf4j.log.Level; 19 | 20 | /** 21 | * @author Zoltan Farkas 22 | */ 23 | @FunctionalInterface 24 | public interface AllLevelsLogHandler extends LogHandler { 25 | 26 | @Override 27 | default Handling handles(Level level) { 28 | return Handling.HANDLE_PASS; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /spf4j-slf4j-test/src/main/java/org/spf4j/test/log/Attachments.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 SPF4J. 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 | package org.spf4j.test.log; 17 | 18 | /** 19 | * 20 | * @author Zoltan Farkas 21 | */ 22 | public final class Attachments { 23 | 24 | public static final String ASSERTED = "ASSERTED"; 25 | 26 | public static final String PRINTED = "PRINTED"; 27 | 28 | public static final String DO_NOT_PRINT = "DO_NOT_PRINT"; 29 | 30 | private Attachments() { } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /spf4j-slf4j-test/src/main/java/org/spf4j/test/log/ConsumeAllLogs.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 SPF4J. 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 | package org.spf4j.test.log; 17 | 18 | import javax.annotation.Nullable; 19 | import org.spf4j.log.Level; 20 | 21 | /** 22 | * @author Zoltan Farkas 23 | */ 24 | final class ConsumeAllLogs implements LogHandler { 25 | 26 | private final Level from; 27 | 28 | private final Level to; 29 | 30 | ConsumeAllLogs(final Level from, final Level to) { 31 | this.from = from; 32 | this.to = to; 33 | } 34 | 35 | 36 | 37 | @Override 38 | public Handling handles(final Level level) { 39 | int ordinal = level.ordinal(); 40 | return (from.ordinal() <= ordinal && to.ordinal() >= ordinal) 41 | ? Handling.HANDLE_CONSUME : Handling.NONE; 42 | } 43 | 44 | @Override 45 | @Nullable 46 | public TestLogRecordImpl handle(final TestLogRecord record) { 47 | return null; 48 | } 49 | 50 | @Override 51 | public String toString() { 52 | return "ConsumeAllLogs{" + "from=" + from + ", to=" + to + '}'; 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /spf4j-slf4j-test/src/main/java/org/spf4j/test/log/ExceptionHandoverRegistry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 SPF4J. 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 | package org.spf4j.test.log; 17 | 18 | /** 19 | * 20 | * @author Zoltan Farkas 21 | */ 22 | public interface ExceptionHandoverRegistry { 23 | 24 | void add(UncaughtExceptionConsumer handover); 25 | 26 | void remove(UncaughtExceptionConsumer handover); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /spf4j-slf4j-test/src/main/java/org/spf4j/test/log/HandlerRegistration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 SPF4J. 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 | package org.spf4j.test.log; 17 | 18 | import edu.umd.cs.findbugs.annotations.CleanupObligation; 19 | import edu.umd.cs.findbugs.annotations.DischargesObligation; 20 | 21 | /** 22 | * 23 | * @author Zoltan Farkas 24 | */ 25 | @CleanupObligation 26 | public interface HandlerRegistration extends AutoCloseable { 27 | /** 28 | * Will unregister this log handler. 29 | */ 30 | @DischargesObligation 31 | void close(); 32 | } 33 | -------------------------------------------------------------------------------- /spf4j-slf4j-test/src/main/java/org/spf4j/test/log/LogAssert.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 SPF4J. 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 | package org.spf4j.test.log; 17 | 18 | /** 19 | * Log behavior assert object. 20 | * @author Zoltan Farkas 21 | */ 22 | public interface LogAssert extends ObservationAssert, HandlerRegistration { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /spf4j-slf4j-test/src/main/java/org/spf4j/test/log/LogCollection.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 SPF4J. 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 | package org.spf4j.test.log; 17 | 18 | import java.util.function.Supplier; 19 | 20 | /** 21 | * 22 | * @author Zoltan Farkas 23 | */ 24 | public interface LogCollection extends HandlerRegistration, Supplier { 25 | 26 | } 27 | -------------------------------------------------------------------------------- /spf4j-slf4j-test/src/main/java/org/spf4j/test/log/LogConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 SPF4J. 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 | package org.spf4j.test.log; 17 | 18 | import java.util.List; 19 | import java.util.function.ToIntFunction; 20 | import javax.annotation.Nullable; 21 | import javax.annotation.ParametersAreNonnullByDefault; 22 | import org.spf4j.log.Level; 23 | 24 | /** 25 | * @author Zoltan Farkas 26 | */ 27 | @ParametersAreNonnullByDefault 28 | public interface LogConfig { 29 | 30 | @Nullable 31 | LogConsumer getLogConsumer(String category, Level level); 32 | 33 | LogConfig add(String category, LogHandler handler, ToIntFunction> whereTo); 34 | 35 | default LogConfig add(final String category, final LogHandler handler) { 36 | return add(category, handler, (l) -> 0); 37 | } 38 | 39 | LogConfig remove(String category, LogHandler handler); 40 | 41 | default Level minRootLevel() { 42 | for (Level l : Level.values()) { 43 | if (getLogConsumer("", l) != null) { 44 | return l; 45 | } 46 | } 47 | return Level.ERROR; 48 | } 49 | 50 | 51 | } 52 | -------------------------------------------------------------------------------- /spf4j-slf4j-test/src/main/java/org/spf4j/test/log/LogConsumer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 SPF4J. 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 | package org.spf4j.test.log; 17 | 18 | import java.util.function.Consumer; 19 | import javax.annotation.ParametersAreNonnullByDefault; 20 | 21 | /** 22 | * @author Zoltan Farkas 23 | */ 24 | @ParametersAreNonnullByDefault 25 | public interface LogConsumer extends Consumer { 26 | } 27 | -------------------------------------------------------------------------------- /spf4j-slf4j-test/src/main/java/org/spf4j/test/log/LogStreamMatcher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 SPF4J. 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 | package org.spf4j.test.log; 17 | 18 | import java.util.function.Consumer; 19 | import org.hamcrest.SelfDescribing; 20 | 21 | /** 22 | * 23 | * @author Zoltan Farkas 24 | */ 25 | public interface LogStreamMatcher extends Consumer, SelfDescribing { 26 | 27 | boolean isMatched(); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /spf4j-slf4j-test/src/main/java/org/spf4j/test/log/TestLogRecord.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 SPF4J. 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 | package org.spf4j.test.log; 17 | 18 | import java.util.List; 19 | import javax.annotation.Nonnull; 20 | import org.spf4j.log.Slf4jLogRecord; 21 | 22 | /** 23 | * 24 | * @author Zoltan Farkas 25 | */ 26 | public interface TestLogRecord extends Slf4jLogRecord { 27 | 28 | @Nonnull 29 | List getExtraThrowableChain(); 30 | 31 | 32 | } 33 | -------------------------------------------------------------------------------- /spf4j-slf4j-test/src/main/java/org/spf4j/test/log/UncaughtExceptionConsumer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 SPF4J. 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 | package org.spf4j.test.log; 17 | 18 | import javax.annotation.CheckReturnValue; 19 | import javax.annotation.ParametersAreNonnullByDefault; 20 | 21 | /** 22 | * @author Zoltan Farkas 23 | */ 24 | @ParametersAreNonnullByDefault 25 | public interface UncaughtExceptionConsumer { 26 | 27 | @CheckReturnValue 28 | boolean offer(UncaughtExceptionDetail exDetail); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /spf4j-slf4j-test/src/main/java/org/spf4j/test/log/ValidationUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 SPF4J. 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 | package org.spf4j.test.log; 17 | 18 | import org.slf4j.Logger; 19 | 20 | /** 21 | * Utilities to validate correct Test logger framework setup. 22 | * 23 | * @author Zoltan Farkas 24 | */ 25 | public final class ValidationUtils { 26 | 27 | private ValidationUtils() { } 28 | 29 | public static void validateLogger(final Logger log) { 30 | if (!(log instanceof TestLogger)) { 31 | throw new ExceptionInInitializerError("Incorrect logging backend is picked up, please make sure:\n" 32 | + " \n" 33 | + " org.spf4j\n" 34 | + " spf4j-slf4j-test\n" 35 | + " test\n" 36 | + " ${project.version}\n" 37 | + " \n is before any other slf4j logging backed (logback, etc...) in your dependencies"); 38 | } 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /spf4j-slf4j-test/src/main/java/org/spf4j/test/log/annotations/ExpectLogs.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 SPF4J. 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 | package org.spf4j.test.log.annotations; 17 | 18 | import java.lang.annotation.ElementType; 19 | import java.lang.annotation.Retention; 20 | import java.lang.annotation.RetentionPolicy; 21 | import java.lang.annotation.Target; 22 | 23 | /** 24 | * Log expectation annotation for multiple logs. 25 | * @author Zoltan Farkas 26 | * @see org.spf4j.test.log.annotations 27 | * @see org.spf4j.test.log.annotations.ExpectLog 28 | */ 29 | @Retention(RetentionPolicy.RUNTIME) 30 | @Target(ElementType.METHOD) 31 | public @interface ExpectLogs { 32 | ExpectLog[] value(); 33 | } 34 | -------------------------------------------------------------------------------- /spf4j-slf4j-test/src/main/java/org/spf4j/test/log/annotations/PrintLogsConfigs.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 SPF4J. 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 | package org.spf4j.test.log.annotations; 17 | 18 | import java.lang.annotation.ElementType; 19 | import java.lang.annotation.Retention; 20 | import java.lang.annotation.RetentionPolicy; 21 | import java.lang.annotation.Target; 22 | 23 | /** 24 | * Support for multiple Printl log configurations 25 | * @author Zoltan Farkas 26 | * @see org.spf4j.test.log.annotations 27 | * @see org.spf4j.test.log.annotations.PrintLogs 28 | */ 29 | @Retention(RetentionPolicy.RUNTIME) 30 | @Target(ElementType.METHOD) 31 | public @interface PrintLogsConfigs { 32 | PrintLogs[] value(); 33 | } 34 | -------------------------------------------------------------------------------- /spf4j-slf4j-test/src/main/java/org/spf4j/test/log/annotations/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * To be able to use the annotations in this package, you need to use the junit RunListener like: 3 | * 4 | * 5 | * {@code 6 | * org.apache.maven.plugins 7 | * maven-surefire-plugin 8 | * 9 | * 10 | * 11 | * listener 12 | * org.spf4j.test.log.junit4.Spf4jTestLogRunListener 13 | * 14 | * 15 | * 16 | * } 17 | * 18 | * you can also use @RunWith(Spf4jTestLogJUnitRunner.class) but it is not as convenient. 19 | * 20 | */ 21 | package org.spf4j.test.log.annotations; 22 | -------------------------------------------------------------------------------- /spf4j-slf4j-test/src/main/java/org/spf4j/test/log/junit4/DetailOnFailureRunListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 SPF4J. 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 | package org.spf4j.test.log.junit4; 17 | 18 | import org.junit.runner.notification.RunListener; 19 | 20 | /** 21 | * @author Zoltan Farkas 22 | * @deprecated use Spf4jTestLogRunListener instead. 23 | */ 24 | @Deprecated 25 | @RunListener.ThreadSafe 26 | public final class DetailOnFailureRunListener extends Spf4jTestLogRunListener { 27 | 28 | } 29 | -------------------------------------------------------------------------------- /spf4j-slf4j-test/src/main/java/org/spf4j/test/log/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * spf4j test log backend for slf4j. 3 | * 4 | * This is an opinionated logging backend implementation with the following features: 5 | * 6 | * - Readable and parse-able output. 7 | * - Fast. (logging is no reason to have slow builds) 8 | * - Ability to assert Logging behavior. 9 | * - Fail unit tests that log an Error by default (if respective Error logs are not asserted against). 10 | * - Make debug logs available on unit test failure. This helps performance a lot by not requiring you to run your 11 | * unit tests with tons of debug info dumped to output all the time. But making it available when you actually need 12 | * it (Unit test failure) 13 | * - Easily change logging configuration via API. 14 | * - Uncaught exceptions from other threads will fail your tests. You can assert them if they are expected. 15 | * - No configurable format, It is the best format so everybody should be using it. Format will be evolved as needed. 16 | * 17 | * 18 | */ 19 | package org.spf4j.test.log; 20 | -------------------------------------------------------------------------------- /spf4j-slf4j-test/src/main/java/org/spf4j/test/matchers/PredicateMatcher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 SPF4J. 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 | package org.spf4j.test.matchers; 17 | 18 | import java.util.function.Predicate; 19 | import org.hamcrest.Description; 20 | import org.hamcrest.Matcher; 21 | import org.hamcrest.TypeSafeMatcher; 22 | 23 | /** 24 | * 25 | * @author Zoltan Farkas 26 | */ 27 | public final class PredicateMatcher extends TypeSafeMatcher { 28 | 29 | private final Predicate predicate; 30 | 31 | public PredicateMatcher(final Predicate predicate) { 32 | this.predicate = predicate; 33 | } 34 | 35 | @Override 36 | protected boolean matchesSafely(final T item) { 37 | return predicate.test(item); 38 | } 39 | 40 | @Override 41 | public void describeTo(final Description description) { 42 | description.appendText("a object testing positively for '" + predicate + "'"); 43 | } 44 | 45 | public static Matcher matchesPredicate(final Predicate pred) { 46 | return new PredicateMatcher<>(pred); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /spf4j-slf4j-test/src/site/site.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | SPF4J 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | org.apache.maven.skins 20 | maven-fluido-skin 21 | 1.7 22 | 23 | 24 | 25 | false 26 | true 27 | width: 90%; 28 | 29 | 30 | -------------------------------------------------------------------------------- /spf4j-slf4j-test/src/test/java/org/spf4j/base/TestTimeSourceTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 SPF4J. 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 | package org.spf4j.base; 17 | 18 | import org.junit.Assert; 19 | import org.junit.Test; 20 | 21 | /** 22 | * 23 | * @author Zoltan Farkas 24 | */ 25 | public class TestTimeSourceTest { 26 | 27 | 28 | @Test 29 | public void testAssertionError() { 30 | TestTimeSource.setTimeStream(0L); 31 | Assert.assertEquals(0L, TimeSource.nanoTime()); 32 | try { 33 | TimeSource.nanoTime(); 34 | Assert.fail(); 35 | } catch (AssertionError e) { 36 | //expected 37 | } 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /spf4j-slf4j-test/src/test/java/org/spf4j/test/log/PrintLogConfigsIOTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 SPF4J. 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 | package org.spf4j.test.log; 17 | 18 | import java.util.Map; 19 | import org.junit.Assert; 20 | import org.junit.Test; 21 | 22 | /** 23 | * 24 | * @author Zoltan Farkas 25 | */ 26 | public class PrintLogConfigsIOTest { 27 | 28 | 29 | @Test 30 | public void testLoadConfig() { 31 | Map cfg = PrintLogConfigsIO.loadConfigFromResource("test-config.properties"); 32 | Assert.assertEquals(4, cfg.size()); 33 | Assert.assertTrue(cfg.containsKey("a.b")); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /spf4j-slf4j-test/src/test/java/org/spf4j/test/log/TestLoggerFactoryTest2.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 SPF4J. 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 | package org.spf4j.test.log; 17 | 18 | import org.junit.Assert; 19 | import org.junit.Assume; 20 | import org.junit.Ignore; 21 | import org.junit.Test; 22 | import org.junit.runner.RunWith; 23 | import org.slf4j.Logger; 24 | import org.slf4j.LoggerFactory; 25 | import org.spf4j.log.Level; 26 | import org.spf4j.test.log.annotations.CollectLogs; 27 | import org.spf4j.test.log.junit4.Spf4jTestLogJUnitRunner; 28 | 29 | /** 30 | * @author Zoltan Farkas 31 | */ 32 | @Ignore 33 | @RunWith(Spf4jTestLogJUnitRunner.class) 34 | public class TestLoggerFactoryTest2 { 35 | 36 | private static final Logger LOG = LoggerFactory.getLogger(TestLoggerFactoryTest2.class); 37 | 38 | 39 | @Test 40 | @CollectLogs(minLevel = Level.OFF) 41 | public void testNoIgnore() { 42 | Assume.assumeFalse(TestUtils.isExecutedFromIDE()); 43 | Assert.assertFalse(LOG.isDebugEnabled()); 44 | } 45 | 46 | 47 | } 48 | -------------------------------------------------------------------------------- /spf4j-slf4j-test/src/test/java/org/spf4j/test/log/TestUtilsTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 SPF4J. 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 | package org.spf4j.test.log; 17 | 18 | import org.junit.Assert; 19 | import org.junit.Test; 20 | 21 | /** 22 | * @author Zoltan Farkas 23 | */ 24 | public class TestUtilsTest { 25 | 26 | 27 | /** 28 | * This test will fail if executed in debug mode. 29 | */ 30 | @Test 31 | public void testIsDebug() { 32 | Assert.assertFalse(TestUtils.isExecutedWithDebuggerAgent()); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /spf4j-slf4j-test/src/test/resources/spf4j-test-prtcfg-ide.properties: -------------------------------------------------------------------------------- 1 | =WARN 2 | a.b=DEBUG 3 | a.b.c.d=WARN,true 4 | -------------------------------------------------------------------------------- /spf4j-slf4j-test/src/test/resources/spf4j-test-prtcfg.properties: -------------------------------------------------------------------------------- 1 | =WARN 2 | a.b=INFO 3 | a.b.c.d=WARN,true 4 | -------------------------------------------------------------------------------- /spf4j-slf4j-test/src/test/resources/test-config.properties: -------------------------------------------------------------------------------- 1 | =INFO 2 | 3 | a.b=INFO,true 4 | 5 | a.b.c=INFO 6 | 7 | c.d=INFO -------------------------------------------------------------------------------- /spf4j-ui/src/main/java/org/spf4j/perf/tsdb/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | * 18 | * Additionally licensed with: 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | package org.spf4j.perf.tsdb; -------------------------------------------------------------------------------- /spf4j-ui/src/main/java/org/spf4j/ui/ComposableFileFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 SPF4J. 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 | package org.spf4j.ui; 17 | 18 | import java.io.File; 19 | import java.io.IOException; 20 | import java.io.UncheckedIOException; 21 | import javax.swing.filechooser.FileFilter; 22 | import org.spf4j.io.Csv; 23 | 24 | /** 25 | * @author Zoltan Farkas 26 | */ 27 | public abstract class ComposableFileFilter extends FileFilter { 28 | 29 | public final ComposableFileFilter or(final FileFilter fileFilter) { 30 | return new ComposableFileFilter() { 31 | 32 | @Override 33 | public String getDescription() { 34 | StringBuilder sb = new StringBuilder(); 35 | try { 36 | Csv.CSV.writeCsvRowNoEOL(sb, ComposableFileFilter.this.getDescription(), fileFilter.getDescription()); 37 | } catch (IOException ex) { 38 | throw new UncheckedIOException(ex); 39 | } 40 | return sb.toString(); 41 | } 42 | 43 | @Override 44 | public boolean accept(final File f) { 45 | return ComposableFileFilter.this.accept(f) || fileFilter.accept(f); 46 | } 47 | 48 | }; 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /spf4j-ui/src/main/java/org/spf4j/ui/Rectangle.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 SPF4J. 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 | package org.spf4j.ui; 17 | 18 | /** 19 | * 20 | * @author Zoltan Farkas 21 | */ 22 | public final class Rectangle { 23 | private final int x; 24 | private final int y; 25 | private final int width; 26 | private final int height; 27 | 28 | public Rectangle(final int x, final int y, final int width, final int height) { 29 | this.x = x; 30 | this.y = y; 31 | this.width = width; 32 | this.height = height; 33 | } 34 | 35 | public int getX() { 36 | return x; 37 | } 38 | 39 | public int getY() { 40 | return y; 41 | } 42 | 43 | public int getWidth() { 44 | return width; 45 | } 46 | 47 | public int getHeight() { 48 | return height; 49 | } 50 | 51 | @Override 52 | public String toString() { 53 | return "Rectangle{" + "x=" + x + ", y=" + y + ", width=" + width + ", height=" + height + '}'; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /spf4j-ui/src/test/java/org/spf4j/ui/package-info.java: -------------------------------------------------------------------------------- 1 | @SuppressFBWarnings({"S508C_NON_TRANSLATABLE_STRING", "S508C_NO_SETSIZE"}) 2 | package org.spf4j.ui; 3 | 4 | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 5 | 6 | -------------------------------------------------------------------------------- /spf4j-ui/src/test/resources/19156@ZMacBookPro.local.tsdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zolyfarkas/spf4j/93154e244d8ea161523e5cba4022be9abe48f231/spf4j-ui/src/test/resources/19156@ZMacBookPro.local.tsdb -------------------------------------------------------------------------------- /spf4j-ui/src/test/resources/com.google.common.io.AppendableWriterBenchmark.spf4jAppendable-Throughput.ssdump2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zolyfarkas/spf4j/93154e244d8ea161523e5cba4022be9abe48f231/spf4j-ui/src/test/resources/com.google.common.io.AppendableWriterBenchmark.spf4jAppendable-Throughput.ssdump2 -------------------------------------------------------------------------------- /spf4j-ui/src/test/resources/jaxrs-spf4j-demo-54557c8c9d-5ndf9_20211030T141848576Z_20211030T151933489Z.ssdump3.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zolyfarkas/spf4j/93154e244d8ea161523e5cba4022be9abe48f231/spf4j-ui/src/test/resources/jaxrs-spf4j-demo-54557c8c9d-5ndf9_20211030T141848576Z_20211030T151933489Z.ssdump3.gz -------------------------------------------------------------------------------- /spf4j-ui/src/test/resources/org.spf4j.concurrent.ThreadPoolBenchmark.spfLifoTpBenchmark-Throughput_m4.ssdump2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zolyfarkas/spf4j/93154e244d8ea161523e5cba4022be9abe48f231/spf4j-ui/src/test/resources/org.spf4j.concurrent.ThreadPoolBenchmark.spfLifoTpBenchmark-Throughput_m4.ssdump2 -------------------------------------------------------------------------------- /spf4j-ui/src/test/resources/test8381720042200787335.tsdb2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zolyfarkas/spf4j/93154e244d8ea161523e5cba4022be9abe48f231/spf4j-ui/src/test/resources/test8381720042200787335.tsdb2 -------------------------------------------------------------------------------- /spf4j-ui/src/test/resources/testProfile.ssp.avro: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zolyfarkas/spf4j/93154e244d8ea161523e5cba4022be9abe48f231/spf4j-ui/src/test/resources/testProfile.ssp.avro -------------------------------------------------------------------------------- /spf4j-zel-javax/src/main/java/org/spf4j/zel/javax/ZelBindings.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 SPF4J. 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 | package org.spf4j.zel.javax; 17 | 18 | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 19 | import java.util.HashMap; 20 | import java.util.Map; 21 | import javax.script.Bindings; 22 | 23 | /** 24 | * @author Zoltan Farkas 25 | */ 26 | @SuppressFBWarnings("SCII_SPOILED_CHILD_INTERFACE_IMPLEMENTOR") 27 | public final class ZelBindings extends HashMap implements Bindings { 28 | 29 | private static final long serialVersionUID = 1L; 30 | 31 | public ZelBindings(final int i, final float f) { 32 | super(i, f); 33 | } 34 | 35 | public ZelBindings(final int i) { 36 | super(i); 37 | } 38 | 39 | public ZelBindings() { 40 | } 41 | 42 | public ZelBindings(final Map map) { 43 | super(map); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /spf4j-zel/fb-exclude.xml: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /spf4j-zel/nbactions.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CUSTOM-generate-sources 5 | generate-sources 6 | 7 | generate-sources 8 | 9 | 10 | 11 | CUSTOM-findbugs-gui 12 | findbugs-gui 13 | 14 | findbugs:gui 15 | 16 | 17 | 18 | run.single.main 19 | 20 | * 21 | 22 | 23 | process-classes 24 | org.codehaus.mojo:exec-maven-plugin:1.6.0:exec 25 | 26 | 27 | -classpath %classpath ${packageClassName} 28 | java 29 | ${classPathScope} 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /spf4j-zel/src/main/java/org/spf4j/zel/instr/SymbolRef.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | * 18 | * Additionally licensed with: 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | package org.spf4j.zel.instr; 33 | 34 | /** 35 | * 36 | * @author zoly 37 | */ 38 | public interface SymbolRef { 39 | String getSymbol(); 40 | } 41 | -------------------------------------------------------------------------------- /spf4j-zel/src/main/java/org/spf4j/zel/instr/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | * 18 | * Additionally licensed with: 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | @SuppressFBWarnings({"CLI_CONSTANT_LIST_INDEX", "ITC_INHERITANCE_TYPE_CHECKING" }) 33 | package org.spf4j.zel.instr; 34 | 35 | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 36 | 37 | -------------------------------------------------------------------------------- /spf4j-zel/src/main/java/org/spf4j/zel/operators/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | * 18 | * Additionally licensed with: 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | @SuppressFBWarnings("BC_UNCONFIRMED_CAST") 33 | package org.spf4j.zel.operators; 34 | 35 | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 36 | 37 | -------------------------------------------------------------------------------- /spf4j-zel/src/main/java/org/spf4j/zel/vm/Method.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | * 18 | * Additionally licensed with: 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | package org.spf4j.zel.vm; 33 | 34 | /** 35 | * 36 | * @author zoly 37 | */ 38 | public interface Method { 39 | 40 | Object invoke(ExecutionContext context, Object[] parameters); 41 | 42 | } -------------------------------------------------------------------------------- /spf4j-zel/src/main/java/org/spf4j/zel/vm/ProcessIO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | * 18 | * Additionally licensed with: 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | package org.spf4j.zel.vm; 33 | 34 | import java.io.InputStream; 35 | import java.io.OutputStream; 36 | 37 | /** 38 | * @author zoly 39 | */ 40 | public interface ProcessIO { 41 | 42 | OutputStream getErr(); 43 | 44 | InputStream getIn(); 45 | 46 | OutputStream getOut(); 47 | 48 | } 49 | -------------------------------------------------------------------------------- /spf4j-zel/src/main/java/org/spf4j/zel/vm/ZelPredicate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 SPF4J. 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 | package org.spf4j.zel.vm; 17 | 18 | import java.util.function.Predicate; 19 | 20 | /** 21 | * 22 | * @author Zoltan Farkas 23 | */ 24 | public interface ZelPredicate extends Predicate { 25 | 26 | String getZelExpression(); 27 | 28 | String getParameterId(); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /spf4j-zel/src/main/java/org/spf4j/zel/vm/gen/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2017, Zoltan Farkas All Rights Reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | * 18 | * Additionally licensed with: 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | @edu.umd.cs.findbugs.annotations.SuppressFBWarnings 33 | package org.spf4j.zel.vm.gen; 34 | -------------------------------------------------------------------------------- /spf4j-zel/src/site/site.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ZEL Expression Language 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | org.apache.maven.skins 21 | maven-fluido-skin 22 | 1.7 23 | 24 | 25 | 26 | false 27 | true 28 | width: 90%; 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /spf4j-zel/src/test/resources/org/spf4j/zel/vm/channel.zel: -------------------------------------------------------------------------------- 1 | ch = channel(); 2 | func prod(ch) { 3 | for i = 0; i < 100 ; i++ { 4 | ch.write(i) 5 | }; 6 | ch.close() 7 | }; 8 | func cons(ch, nr) { 9 | sum = 0; 10 | for c = ch.read(); c != EOF; c = ch.read() { 11 | out(c, ","); 12 | sum = sum + c 13 | }; 14 | out("fin(", nr, ",", sum, ")"); 15 | return sum 16 | }; 17 | arr = array(10); 18 | prod(ch)&; 19 | for i = 0; i < 10; i++ { 20 | arr[i] = cons(ch, i)& 21 | }; 22 | sum = 0; 23 | for i = 0; i < 10; i++ { sum = sum + arr[i] }; 24 | return sum 25 | -------------------------------------------------------------------------------- /spf4j-zel/src/test/resources/org/spf4j/zel/vm/comments.zel: -------------------------------------------------------------------------------- 1 | /* 2 | /**/ 3 | out("output: ", "*/", "/*") 4 | */ 5 | out("output: ", "*/", "/*"); 6 | return 1 7 | /* 8 | out("output: ", "*/", "/*") -------------------------------------------------------------------------------- /spf4j-zel/src/test/resources/org/spf4j/zel/vm/minmax.zel: -------------------------------------------------------------------------------- 1 | func minmax (arr) { 2 | mi = arr[0]; ma = mi; 3 | for i=1; i < arr.length; i++ { 4 | v = arr[i]; 5 | if v > ma { 6 | ma = v 7 | } else if v < mi { 8 | mi = v 9 | } 10 | }; 11 | ret {mi, ma} 12 | }; 13 | x = {1, 2, 3, 8, 0}; 14 | _min, _max = minmax(x); 15 | out(_min, _max); 16 | ret _max -------------------------------------------------------------------------------- /spf4j-zel/src/test/resources/org/spf4j/zel/vm/parallelPi.zel: -------------------------------------------------------------------------------- 1 | func piPart (s, x) { 2 | term = func sync (k) {4 * (-1 ** k) / (2d * k + 1)}; 3 | for i = s; i < x; i++ { 4 | parts[i] = term(i) 5 | }; 6 | 7 | for result = 0, i = s; i < x; i++ { 8 | result = result + parts[i] 9 | }; 10 | return result 11 | }; 12 | 13 | pi = func (x, breakup) { 14 | range = x / breakup; 15 | l = breakup - 1; 16 | for i = 0, result = 0, k = 0; i < l; i++ { 17 | part[i] = piPart(k, k + range); 18 | k = k + range 19 | }; 20 | part[i] = piPart(k, x); 21 | for i = 0, result = 0; i < breakup; i = i + 1 { 22 | result = result + part[i] 23 | }; 24 | return result 25 | }; 26 | pi(x, 5) -------------------------------------------------------------------------------- /spf4j-zel/src/test/resources/org/spf4j/zel/vm/replicas.zel: -------------------------------------------------------------------------------- 1 | replica = func async (x) { 2 | sleep random() * 1000; 3 | out(x, " finished\n"); 4 | return x 5 | }; 6 | val = first(replica(1), replica(2), replica(3)); 7 | out(val , " finished first\n"); 8 | return val -------------------------------------------------------------------------------- /spf4j-zel/src/test/resources/org/spf4j/zel/vm/sleepSort.zel: -------------------------------------------------------------------------------- 1 | /** 2 | * Sleep sort implementation in ZEL :-) 3 | * this takes advantage of the concurrency facilities available in ZEL. 4 | * Sleep values are multiplied by 10 due to scheduler precision. 5 | */ 6 | 7 | func sleepSort(x) { 8 | l = x.length; 9 | if l <= 1 { 10 | return x 11 | }; 12 | resChan = channel(); 13 | max = x[0]; 14 | sl = func (x, ch) {sleep x * 100; ch.write(x)}; 15 | sl(max, resChan)&; 16 | for i = 1; i < l; i++ { 17 | val = x[i]; 18 | sl(val, resChan)&; 19 | if val > max { 20 | max = val 21 | } 22 | }; 23 | sleep (max + 5) * 100; 24 | resChan.close(); 25 | for c = resChan.read(), i = 0; c != EOF; c = resChan.read(), i++ { 26 | x[i] = c 27 | }; 28 | return x 29 | }; 30 | 31 | sleepSort(x) 32 | -------------------------------------------------------------------------------- /spf4j-zel/src/test/resources/org/spf4j/zel/vm/sort.zel: -------------------------------------------------------------------------------- 1 | func qSortP(x, start, end) { 2 | l = end - start; 3 | if l < 2 { 4 | return 5 | }; 6 | pidx = start + l / 2; 7 | pivot = x[pidx]; 8 | lm1 = end -1; 9 | x[pidx] <-> x[lm1]; 10 | npv = start; 11 | for i = start; i < lm1; i++ { 12 | if x[i] < pivot { 13 | x[npv] <-> x[i]; 14 | npv ++ 15 | } 16 | }; 17 | x[npv] <-> x[lm1]; 18 | qSortP(x, start, npv)&; 19 | qSortP(x, npv + 1, end)& 20 | }; 21 | 22 | func qSort(x) { 23 | qSortP(x, 0, x.length) 24 | }; 25 | 26 | func sync printArr(arr) { 27 | for i = 0; i < arr.length; i++ { 28 | out(arr[i], ", ") 29 | }; 30 | out("\n") 31 | }; 32 | 33 | arr = array(10000); 34 | for i = 0; i < arr.length; i++ { 35 | arr[i] = int(random() * 1000) 36 | }; 37 | 38 | //printArr(arr); 39 | res = qSort(arr); 40 | sync res; 41 | //printArr(arr); 42 | return arr.length 43 | 44 | -------------------------------------------------------------------------------- /spf4j-zel/src/test/resources/org/spf4j/zel/vm/sortFunc.zel: -------------------------------------------------------------------------------- 1 | func qSortP(x, start, end) { 2 | l = end - start; 3 | if l < 2 { 4 | return 5 | }; 6 | pidx = start + l / 2; 7 | pivot = x[pidx]; 8 | lm1 = end - 1; 9 | x[pidx] <-> x[lm1]; 10 | npv = start; 11 | for i = start; i < lm1; i++ { 12 | if x[i] < pivot { 13 | x[npv] <-> x[i]; 14 | npv ++ 15 | } 16 | }; 17 | x[npv] <-> x[lm1]; 18 | qSortP(x, start, npv)&; 19 | qSortP(x, npv + 1, end)& 20 | }; 21 | 22 | qSortP(x, 0, x.length) 23 | -------------------------------------------------------------------------------- /spf4j-zel/src/test/resources/org/spf4j/zel/vm/stringEscaping.zel: -------------------------------------------------------------------------------- 1 | a=1; 2 | b="cucu"; 3 | out("val \{a} and \{b}") -------------------------------------------------------------------------------- /spf4j-zel/todo.txt: -------------------------------------------------------------------------------- 1 | 1) make concurency more obvious. 2 | sync rename to sync-all? Validate that no attempt to call anything async is being done from a syncall... 3 | functions that are called and result is disregarded need to be executed synchronously. 4 | -------------------------------------------------------------------------------- /src/site/resources/images/explorer-ui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zolyfarkas/spf4j/93154e244d8ea161523e5cba4022be9abe48f231/src/site/resources/images/explorer-ui.png -------------------------------------------------------------------------------- /src/site/resources/images/spf4j-flame-graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zolyfarkas/spf4j/93154e244d8ea161523e5cba4022be9abe48f231/src/site/resources/images/spf4j-flame-graph.png -------------------------------------------------------------------------------- /src/site/resources/images/spf4j_allocations.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zolyfarkas/spf4j/93154e244d8ea161523e5cba4022be9abe48f231/src/site/resources/images/spf4j_allocations.png -------------------------------------------------------------------------------- /src/site/resources/images/spf4j_dist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zolyfarkas/spf4j/93154e244d8ea161523e5cba4022be9abe48f231/src/site/resources/images/spf4j_dist.png -------------------------------------------------------------------------------- /src/site/resources/images/spf4j_io.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zolyfarkas/spf4j/93154e244d8ea161523e5cba4022be9abe48f231/src/site/resources/images/spf4j_io.png -------------------------------------------------------------------------------- /src/site/resources/images/spf4j_min_max_avg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zolyfarkas/spf4j/93154e244d8ea161523e5cba4022be9abe48f231/src/site/resources/images/spf4j_min_max_avg.png -------------------------------------------------------------------------------- /src/site/resources/jaxrs-spf4j-demo_20200131T160810753Z_20200131T170850286Z.ssdump3.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zolyfarkas/spf4j/93154e244d8ea161523e5cba4022be9abe48f231/src/site/resources/jaxrs-spf4j-demo_20200131T160810753Z_20200131T170850286Z.ssdump3.gz -------------------------------------------------------------------------------- /src/site/site.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | SPF4J 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | org.apache.maven.skins 21 | maven-fluido-skin 22 | 1.7 23 | 24 | 25 | 26 | false 27 | true 28 | width: 90%; 29 | 30 | 31 | --------------------------------------------------------------------------------