├── .gitignore ├── .mvn └── maven.config ├── LICENSE ├── Readme.md ├── actor4j-core-runtime-base ├── .gitignore ├── LICENSE ├── pom.xml └── src │ └── main │ └── java │ └── io │ └── actor4j │ └── core │ └── runtime │ ├── AbstractActorExecutionUnitPool.java │ ├── AbstractActorExecutionUnitPoolHandler.java │ ├── ActorExecutionUnit.java │ ├── ActorExecutionUnitPool.java │ ├── ActorExecutionUnitPoolHandler.java │ ├── ActorExecutorServiceImpl.java │ ├── ActorSystemImpl.java │ ├── ActorTimerExecutorService.java │ ├── BaseActorCell.java │ ├── BaseActorMessageDispatcher.java │ ├── DefaultActorExecutionUnitPoolHandler.java │ ├── DefaultActorStrategyOnFailure.java │ ├── DefaultPodReplicationControllerRunnable.java │ ├── DefaultThreadFactory.java │ ├── DefaultWatchdogRunnable.java │ ├── InternalActorExecutorService.java │ ├── InternalActorRuntimeSystem.java │ ├── PodActorCell.java │ ├── PseudoActorCell.java │ ├── ResourceActorCell.java │ ├── annotations │ └── concurrent │ │ ├── Readonly.java │ │ ├── ThreadLocalAccess.java │ │ └── ThreadSafeAccess.java │ ├── balancing │ ├── ActorLoadBalancingAfterStart.java │ └── ActorLoadBalancingBeforeStart.java │ ├── persistence │ └── ActorPersistenceServiceImpl.java │ ├── pods │ ├── DefaultPodReplicationController.java │ └── PodDeployment.java │ ├── protocols │ ├── RecoverProtocol.java │ ├── RestartProtocol.java │ ├── StopProtocol.java │ └── StopUserSpaceProtocol.java │ └── utils │ └── ProcessingTimeStatistics.java ├── actor4j-core-runtime-classic ├── .gitignore ├── LICENSE ├── pom.xml └── src │ ├── main │ └── java │ │ └── io │ │ └── actor4j │ │ └── core │ │ ├── ActorRuntime.java │ │ ├── ActorServiceRuntime.java │ │ ├── ClassicActorRuntime.java │ │ ├── ClassicActorServiceRuntime.java │ │ └── runtime │ │ └── classic │ │ ├── ActorMessageDispatcherCallback.java │ │ ├── ActorRunnable.java │ │ ├── ActorRunnableMetrics.java │ │ ├── ActorRunnablePool.java │ │ ├── ClassicActorCell.java │ │ ├── ClassicDefaultActorExecutorService.java │ │ ├── ClassicDefaultActorMessageDispatcher.java │ │ ├── ClassicDefaultActorSystemImpl.java │ │ ├── ClassicInternalActorCell.java │ │ ├── ClassicInternalActorExecutorService.java │ │ ├── ClassicPodActorCell.java │ │ ├── DefaultActorRunnable.java │ │ └── utils │ │ └── ClassicForkJoinWorkerThread.java │ └── test │ └── java │ └── io │ └── actor4j │ └── core │ └── features │ ├── ActorFeature.java │ ├── ActorGroupMemberFeature.java │ ├── AllFeaturesTest.java │ ├── AskPatternFeature.java │ ├── AwaitFeature.java │ ├── BehaviourFeature.java │ ├── CacheFeature.java │ ├── CacheHandlerFeature.java │ ├── CommPatternFeature.java │ ├── ConcurrentPseudoActorFeature.java │ ├── ConfigFeature.java │ ├── EmbeddedActorFeature.java │ ├── FaultToleranceFeature.java │ ├── HandlerFeature.java │ ├── LifeCycleFeature.java │ ├── MatcherFeature.java │ ├── OptionalFeature.java │ ├── PodFeature.java │ ├── PrimarySecondaryActorFeature.java │ ├── PseudoActorFeature.java │ ├── ResourceActorFeature.java │ ├── ServiceDiscoveyFeature.java │ ├── StatelessActorFeature.java │ └── pod │ ├── ExampleReplicationWithActorPod.java │ ├── ExampleReplicationWithFunctionPod.java │ ├── ExampleReplicationWithRemoteActorPodWithRequest.java │ ├── ExampleReplicationWithRemoteFunctionImpl.java │ ├── ExampleReplicationWithRemoteFunctionPod.java │ ├── ExampleShardingWithActorPod.java │ └── HelloActor.java ├── actor4j-core-runtime-extended ├── .gitignore ├── LICENSE ├── doc │ └── Readme.txt ├── pom.xml └── src │ └── main │ ├── java │ └── io │ │ └── actor4j │ │ └── core │ │ ├── XActorRuntime.java │ │ ├── XActorService.java │ │ ├── XActorServiceRuntime.java │ │ ├── XActorSystem.java │ │ ├── actors │ │ ├── ActorWithRxStash.java │ │ ├── ConcurrentPseudoActorWithRx.java │ │ ├── PseudoActorWithRx.java │ │ └── XActor.java │ │ ├── config │ │ ├── XActorServiceConfig.java │ │ └── XActorSystemConfig.java │ │ ├── logging │ │ └── XActorLogger.java │ │ ├── runtime │ │ └── extended │ │ │ ├── BoundedActorThread.java │ │ │ ├── UnboundedActorThread.java │ │ │ ├── XDefaultActorSystemImpl.java │ │ │ └── di │ │ │ ├── ConstructorInjector.java │ │ │ ├── DIMapEntry.java │ │ │ └── DefaultDIContainer.java │ │ └── utils │ │ ├── ActorMessageFlowable.java │ │ └── Utils.java │ └── resources │ └── log4j2.properties ├── actor4j-core-runtime-loom ├── .gitignore ├── LICENSE ├── pom.xml └── src │ ├── main │ └── java │ │ └── io │ │ └── actor4j │ │ └── core │ │ ├── ActorRuntime.java │ │ ├── ActorServiceRuntime.java │ │ ├── VirtualActorRuntime.java │ │ ├── VirtualActorServiceRuntime.java │ │ └── runtime │ │ └── loom │ │ ├── DefaultVirtualActorExecutorService.java │ │ ├── DefaultVirtualActorMessageDispatcher.java │ │ ├── DefaultVirtualActorRunnable.java │ │ ├── DefaultVirtualActorRunnablePoolHandler.java │ │ ├── DefaultVirtualActorSystemImpl.java │ │ ├── InternalVirtualActorExecutorService.java │ │ ├── VirtualActorRunnable.java │ │ ├── VirtualActorRunnableMetrics.java │ │ ├── VirtualActorRunnablePool.java │ │ ├── VirtualActorRunnablePoolHandler.java │ │ ├── VirtualActorRunnablePoolHandlerFactory.java │ │ ├── VirtualBaseActorCell.java │ │ ├── VirtualInternalActorCell.java │ │ └── VirtualPodActorCell.java │ └── test │ └── java │ └── io │ └── actor4j │ └── core │ └── features │ ├── ActorFeature.java │ ├── ActorGroupMemberFeature.java │ ├── AllFeaturesTest.java │ ├── AskPatternFeature.java │ ├── AwaitFeature.java │ ├── BehaviourFeature.java │ ├── CacheFeature.java │ ├── CacheHandlerFeature.java │ ├── CommPatternFeature.java │ ├── ConcurrentPseudoActorFeature.java │ ├── ConfigFeature.java │ ├── EmbeddedActorFeature.java │ ├── FaultToleranceFeature.java │ ├── HandlerFeature.java │ ├── LifeCycleFeature.java │ ├── MatcherFeature.java │ ├── OptionalFeature.java │ ├── PodFeature.java │ ├── PrimarySecondaryActorFeature.java │ ├── PseudoActorFeature.java │ ├── ResourceActorFeature.java │ ├── ServiceDiscoveyFeature.java │ ├── StatelessActorFeature.java │ ├── WatchdogFeature.java │ └── pod │ ├── ExampleReplicationWithActorPod.java │ ├── ExampleReplicationWithFunctionPod.java │ ├── ExampleReplicationWithRemoteActorPodWithRequest.java │ ├── ExampleReplicationWithRemoteFunctionImpl.java │ ├── ExampleReplicationWithRemoteFunctionPod.java │ ├── ExampleShardingWithActorPod.java │ └── HelloActor.java ├── actor4j-core-runtime ├── .gitignore ├── LICENSE ├── pom.xml └── src │ ├── main │ └── java │ │ └── io │ │ └── actor4j │ │ └── core │ │ ├── ActorRuntime.java │ │ ├── ActorServiceRuntime.java │ │ └── runtime │ │ ├── ActorThread.java │ │ ├── ActorThreadFactory.java │ │ ├── ActorThreadPool.java │ │ ├── ActorThreadPoolHandler.java │ │ ├── DefaultActorExecutorService.java │ │ ├── DefaultActorMessageDispatcher.java │ │ ├── DefaultActorSystemImpl.java │ │ ├── DefaultActorThread.java │ │ ├── DefaultActorThreadFactory.java │ │ ├── DefaultInternalActorExecutorService.java │ │ ├── DefaultInternalActorRuntimeSystem.java │ │ └── DefaultUnboundedActorThread.java │ └── test │ └── java │ └── io │ └── actor4j │ └── core │ └── features │ ├── ActorFeature.java │ ├── ActorGroupMemberFeature.java │ ├── AllFeaturesTest.java │ ├── AskPatternFeature.java │ ├── AwaitFeature.java │ ├── BehaviourFeature.java │ ├── CacheFeature.java │ ├── CacheHandlerFeature.java │ ├── CommPatternFeature.java │ ├── ConcurrentPseudoActorFeature.java │ ├── ConfigFeature.java │ ├── EmbeddedActorFeature.java │ ├── EmbeddedActorLifeCycleFeature.java │ ├── FaultToleranceFeature.java │ ├── HandlerFeature.java │ ├── LifeCycleFeature.java │ ├── MatcherFeature.java │ ├── OptionalFeature.java │ ├── PodFeature.java │ ├── PrimarySecondaryActorFeature.java │ ├── PseudoActorFeature.java │ ├── ResourceActorFeature.java │ ├── ServiceDiscoveyFeature.java │ ├── StatelessActorFeature.java │ ├── UnsafeFeature.java │ ├── WatchdogFeature.java │ └── pod │ ├── ExampleReplicationWithActorPod.java │ ├── ExampleReplicationWithFunctionPod.java │ ├── ExampleReplicationWithRemoteActorPodWithRequest.java │ ├── ExampleReplicationWithRemoteFunctionImpl.java │ ├── ExampleReplicationWithRemoteFunctionPod.java │ ├── ExampleShardingWithActorPod.java │ └── HelloActor.java ├── actor4j-core-sdk ├── .gitignore ├── LICENSE ├── pom.xml └── src │ └── main │ └── java │ └── io │ └── actor4j │ └── core │ ├── ActorCell.java │ ├── ActorPodService.java │ ├── ActorService.java │ ├── ActorSystem.java │ ├── ActorSystemFactory.java │ ├── EmbeddedActorCell.java │ ├── actors │ ├── Actor.java │ ├── ActorDistributedGroupMember.java │ ├── ActorGroupMember.java │ ├── ActorIgnoreDistributedGroupMember.java │ ├── ActorRef.java │ ├── ActorRegionMember.java │ ├── ActorVersionNumber.java │ ├── ActorWithBothGroups.java │ ├── ActorWithCache.java │ ├── ActorWithDistributedGroup.java │ ├── ActorWithGroup.java │ ├── ConcurrentPseudoActor.java │ ├── EmbeddedActor.java │ ├── EmbeddedActorRef.java │ ├── EmbeddedHandlerActor.java │ ├── EmbeddedHostActor.java │ ├── PersistenceId.java │ ├── PersistentActor.java │ ├── PrimaryActor.java │ ├── PseudoActor.java │ ├── PseudoActorRef.java │ ├── ResourceActor.java │ ├── SecondaryActor.java │ └── StatelessActor.java │ ├── config │ ├── ActorServiceConfig.java │ └── ActorSystemConfig.java │ ├── exceptions │ ├── ActorInitializationException.java │ ├── ActorKilledException.java │ ├── ActorResourceException.java │ └── ActorSystemConfigException.java │ ├── function │ ├── Procedure.java │ ├── QuadConsumer.java │ ├── QuintConsumer.java │ ├── SextConsumer.java │ ├── TriConsumer.java │ └── TriFunction.java │ ├── id │ ├── ActorId.java │ ├── GlobalId.java │ └── RedirectId.java │ ├── immutable │ ├── ImmutableCollection.java │ ├── ImmutableList.java │ ├── ImmutableMap.java │ ├── ImmutableObject.java │ └── ImmutableSet.java │ ├── json │ ├── JsonArray.java │ ├── JsonObject.java │ ├── ObjectMapper.java │ └── api │ │ ├── JsonFactoryService.java │ │ └── ObjectMapperService.java │ ├── logging │ ├── ActorLogger.java │ └── LoggerFactory.java │ ├── messages │ ├── ActorMessage.java │ ├── ActorMessageUtils.java │ ├── ActorReservedTag.java │ ├── DefaultActorMessage.java │ ├── DefaultPodActorMessage.java │ └── PodActorMessage.java │ ├── mutable │ └── MutableObject.java │ ├── persistence │ ├── ActorPersistenceDTO.java │ └── drivers │ │ ├── PersistenceDriver.java │ │ └── PersistenceImpl.java │ ├── pods │ ├── ActorPod.java │ ├── DefaultActorPod.java │ ├── DefaultRemoteActorPod.java │ ├── Pod.java │ ├── PodConfiguration.java │ ├── PodContext.java │ ├── PodFactory.java │ ├── RemotePodMessage.java │ ├── RemotePodMessageDTO.java │ ├── Shard.java │ ├── SystemPod.java │ ├── actors │ │ ├── DefaultPodActor.java │ │ ├── DefaultShardPodActor.java │ │ ├── EmbeddedHandlerPodActor.java │ │ ├── HandlerPodActor.java │ │ ├── HandlerPodActorFactory.java │ │ ├── PodActor.java │ │ ├── PodChildActor.java │ │ ├── RemoteHandlerPodActor.java │ │ ├── ShardProxyPodActor.java │ │ └── ShardProxyPodActorFactory.java │ ├── api │ │ ├── Caching.java │ │ ├── Database.java │ │ └── Host.java │ ├── functions │ │ ├── FunctionPod.java │ │ ├── PodFunction.java │ │ ├── PodRemoteFunction.java │ │ └── RemoteFunctionPod.java │ └── utils │ │ ├── PodActorMessageProxyHandler.java │ │ ├── PodRequestMethod.java │ │ ├── PodRequestParam.java │ │ └── PodStatus.java │ ├── runtime │ ├── ActorExecutorService.java │ ├── ActorGlobalSettings.java │ ├── ActorMessageDispatcher.java │ ├── ActorStrategyOnFailure.java │ ├── ActorSystemError.java │ ├── ActorThreadMode.java │ ├── InternalActorCell.java │ ├── InternalActorSystem.java │ ├── InternalPodActorCell.java │ ├── InternalPseudoActorCell.java │ ├── PodReplicationControllerRunnable.java │ ├── PodReplicationControllerRunnableFactory.java │ ├── PseudoActorCellFactory.java │ ├── WatchdogRunnable.java │ ├── WatchdogRunnableFactory.java │ ├── di │ │ ├── DIContainer.java │ │ ├── DefaultDIContainer.java │ │ └── FactoryInjector.java │ ├── embedded │ │ ├── ActorEmbeddedRouter.java │ │ ├── BaseEmbeddedActorCell.java │ │ ├── DefaultEmbeddedActorStrategyOnFailure.java │ │ ├── EmbeddedActorStrategyOnFailure.java │ │ ├── EmbeddedHostActorImpl.java │ │ ├── InternalEmbeddedActorCell.java │ │ └── protocol │ │ │ ├── RestartProtocol.java │ │ │ └── StopProtocol.java │ ├── fault │ │ └── tolerance │ │ │ ├── ErrorHandler.java │ │ │ ├── FaultTolerance.java │ │ │ ├── FaultToleranceManager.java │ │ │ └── FaultToleranceMethod.java │ ├── persistence │ │ ├── ActorPersistenceService.java │ │ └── actor │ │ │ └── PersistenceServiceActor.java │ ├── pods │ │ ├── PodReplicationController.java │ │ ├── PodReplicationTuple.java │ │ └── PodSystemConfiguration.java │ ├── protocols │ │ └── ActorProtocolTag.java │ └── service │ │ └── loader │ │ └── ServiceLoader.java │ ├── serializer │ └── api │ │ └── SerializerService.java │ ├── service │ ├── discovery │ │ ├── Service.java │ │ ├── ServiceDiscoveryActor.java │ │ └── ServiceDiscoveryManager.java │ └── support │ │ ├── PodSupportService.java │ │ └── SupportService.java │ ├── supervisor │ ├── DefaultSupervisorStrategy.java │ ├── OneForAllSupervisorStrategy.java │ ├── OneForOneSupervisorStrategy.java │ ├── SupervisorStrategy.java │ └── SupervisorStrategyDirective.java │ └── utils │ ├── ActorCacheHandler.java │ ├── ActorFactory.java │ ├── ActorGroup.java │ ├── ActorGroupList.java │ ├── ActorGroupSet.java │ ├── ActorMessageHandler.java │ ├── ActorMessageMatcher.java │ ├── ActorMessageMatcherHandler.java │ ├── ActorMessageProxyHandler.java │ ├── ActorOptional.java │ ├── ActorTimer.java │ ├── ActorUtils.java │ ├── AskPattern.java │ ├── Cache.java │ ├── CacheAsMap.java │ ├── CacheLRU.java │ ├── CacheVolatileLRU.java │ ├── CircuitBreaker.java │ ├── CommPattern.java │ ├── ConcurrentActorGroupQueue.java │ ├── ConcurrentActorGroupSet.java │ ├── DeepCopyable.java │ ├── EmbeddedActorFactory.java │ ├── GenericType.java │ ├── HubPattern.java │ ├── Pair.java │ ├── PodActorFactory.java │ ├── Range.java │ ├── ReadOnlyCache.java │ ├── Shareable.java │ └── Triple.java ├── doc ├── actor4j.asta ├── actor4j.tags.md ├── actor4j.yuml.me └── images │ ├── analyzer.png │ ├── cd_left_right.png │ ├── cd_top_down.png │ ├── class diagram.png │ ├── lifecycle1.png │ ├── lifecycle1_v2.png │ ├── lifecycle2.png │ ├── promo.png │ ├── rest api.png │ └── supervision.png └── pom.xml /.mvn/maven.config: -------------------------------------------------------------------------------- 1 | -Drevision=2.4.0 -------------------------------------------------------------------------------- /actor4j-core-runtime-base/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | -------------------------------------------------------------------------------- /actor4j-core-runtime-base/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | io.actor4j 5 | actor4j-core 6 | ${revision} 7 | 8 | actor4j-core-runtime-base 9 | jar 10 | 11 | ${project.groupId}:${project.artifactId} 12 | Actor4j is an actor-oriented Java framework. 13 | https://github.com/relvaner/actor4j-core 14 | 2015 15 | 16 | 17 | 18 | The Apache License, Version 2.0 19 | http://www.apache.org/licenses/LICENSE-2.0.txt 20 | repo 21 | 22 | 23 | 24 | 25 | 26 | David A. Bauer 27 | relvaner.github@gmail.com 28 | 29 | 30 | 31 | 32 | 33 | io.actor4j 34 | actor4j-core-sdk 35 | ${revision} 36 | 37 | 38 | -------------------------------------------------------------------------------- /actor4j-core-runtime-base/src/main/java/io/actor4j/core/runtime/ActorExecutionUnitPoolHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime; 17 | 18 | import io.actor4j.core.messages.ActorMessage; 19 | 20 | public interface ActorExecutionUnitPoolHandler { 21 | public void postPersistence(ActorMessage message); 22 | 23 | public void registerCell(InternalActorCell cell); 24 | public void unregisterCell(InternalActorCell cell); 25 | public boolean isRegisteredCell(InternalActorCell cell); 26 | } 27 | -------------------------------------------------------------------------------- /actor4j-core-runtime-base/src/main/java/io/actor4j/core/runtime/DefaultActorExecutionUnitPoolHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime; 17 | 18 | import java.util.List; 19 | import java.util.Map; 20 | 21 | public interface DefaultActorExecutionUnitPoolHandler extends ActorExecutionUnitPoolHandler { 22 | public Map getExecutionUnitMap(); 23 | public List getExecutionUnitList(); 24 | 25 | public void beforeStart(List executionUnitList); 26 | } 27 | -------------------------------------------------------------------------------- /actor4j-core-runtime-base/src/main/java/io/actor4j/core/runtime/DefaultPodReplicationControllerRunnable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2020, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime; 17 | 18 | import static io.actor4j.core.logging.ActorLogger.*; 19 | 20 | public class DefaultPodReplicationControllerRunnable extends PodReplicationControllerRunnable { 21 | public DefaultPodReplicationControllerRunnable(InternalActorSystem system) { 22 | super(system); 23 | } 24 | 25 | @Override 26 | public void onRun() { 27 | horizontalPodAutoscaler(); 28 | } 29 | 30 | public void horizontalPodAutoscaler() { 31 | systemLogger().log(DEBUG, String.format("[REPLICATION][AUTOSCALER] sync")); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /actor4j-core-runtime-base/src/main/java/io/actor4j/core/runtime/InternalActorExecutorService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime; 17 | 18 | public interface InternalActorExecutorService extends ActorExecutorService { 19 | public ActorExecutionUnitPool getExecutionUnitPool(); 20 | } 21 | -------------------------------------------------------------------------------- /actor4j-core-runtime-base/src/main/java/io/actor4j/core/runtime/InternalActorRuntimeSystem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime; 17 | 18 | import io.actor4j.core.id.ActorId; 19 | import io.actor4j.core.runtime.di.DIContainer; 20 | 21 | public interface InternalActorRuntimeSystem extends InternalActorSystem { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /actor4j-core-runtime-base/src/main/java/io/actor4j/core/runtime/PodActorCell.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2020, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime; 17 | 18 | import static io.actor4j.core.logging.ActorLogger.*; 19 | 20 | import java.util.concurrent.atomic.AtomicReference; 21 | 22 | import io.actor4j.core.actors.Actor; 23 | import io.actor4j.core.pods.PodContext; 24 | 25 | public class PodActorCell extends BaseActorCell implements InternalPodActorCell { 26 | protected final AtomicReference contextReference; 27 | 28 | public PodActorCell(InternalActorSystem system, Actor actor) { 29 | super(system, actor); 30 | 31 | this.contextReference = new AtomicReference<>(); 32 | } 33 | 34 | @Override 35 | public boolean isPod() { 36 | return true; 37 | } 38 | 39 | @Override 40 | public PodContext getContext() { 41 | return contextReference.get(); 42 | } 43 | 44 | @Override 45 | public void setContext(PodContext context) { 46 | contextReference.set(context); 47 | } 48 | 49 | @Override 50 | public void preStart() { 51 | systemLogger().log(INFO, String.format("[REPLICATION] PodActor (%s, %s) starting", getContext().domain(), getId())); 52 | super.preStart(); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /actor4j-core-runtime-base/src/main/java/io/actor4j/core/runtime/annotations/concurrent/Readonly.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2019, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime.annotations.concurrent; 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 | @Retention(RetentionPolicy.SOURCE) 24 | @Target({ElementType.FIELD}) 25 | public @interface Readonly { 26 | } -------------------------------------------------------------------------------- /actor4j-core-runtime-base/src/main/java/io/actor4j/core/runtime/annotations/concurrent/ThreadLocalAccess.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2025, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime.annotations.concurrent; 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 | @Retention(RetentionPolicy.SOURCE) 24 | @Target({ElementType.FIELD}) 25 | public @interface ThreadLocalAccess { 26 | String reason() default ""; 27 | } -------------------------------------------------------------------------------- /actor4j-core-runtime-base/src/main/java/io/actor4j/core/runtime/annotations/concurrent/ThreadSafeAccess.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2025, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime.annotations.concurrent; 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 | @Retention(RetentionPolicy.SOURCE) 24 | @Target({ElementType.FIELD}) 25 | public @interface ThreadSafeAccess { 26 | String reason() default ""; 27 | } -------------------------------------------------------------------------------- /actor4j-core-runtime-base/src/main/java/io/actor4j/core/runtime/protocols/RecoverProtocol.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2017, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime.protocols; 17 | 18 | import io.actor4j.core.actors.PersistentActor; 19 | import io.actor4j.core.messages.ActorMessage; 20 | import io.actor4j.core.runtime.InternalActorCell; 21 | import io.actor4j.core.runtime.InternalActorSystem; 22 | import io.actor4j.core.runtime.persistence.actor.PersistenceServiceActor; 23 | 24 | public final class RecoverProtocol { 25 | public static void apply(final InternalActorCell cell) { 26 | if (cell.getSystem().getConfig().persistenceMode() && cell.getActor() instanceof PersistentActor) { 27 | cell.setActive(false); 28 | ((InternalActorSystem)cell.getSystem()).getMessageDispatcher().postPersistence( 29 | ActorMessage.create(((PersistentActor)cell.getActor()).persistenceId().toString(), PersistenceServiceActor.RECOVER, cell.getId(), null)); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /actor4j-core-runtime-classic/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | -------------------------------------------------------------------------------- /actor4j-core-runtime-classic/pom.xml: -------------------------------------------------------------------------------- 1 | 4 | 4.0.0 5 | 6 | io.actor4j 7 | actor4j-core 8 | ${revision} 9 | 10 | actor4j-core-runtime-classic 11 | jar 12 | 13 | ${project.groupId}:${project.artifactId} 14 | Actor4j is an actor-oriented Java framework. 15 | https://github.com/relvaner/actor4j-core 16 | 2015 17 | 18 | 19 | 20 | The Apache License, Version 2.0 21 | http://www.apache.org/licenses/LICENSE-2.0.txt 22 | repo 23 | 24 | 25 | 26 | 27 | 28 | David A. Bauer 29 | relvaner.github@gmail.com 30 | 31 | 32 | 33 | 34 | 35 | io.actor4j 36 | actor4j-core-runtime-base 37 | ${revision} 38 | 39 | 40 | 41 | org.junit.vintage 42 | junit-vintage-engine 43 | ${junit.version} 44 | test 45 | 46 | 47 | -------------------------------------------------------------------------------- /actor4j-core-runtime-classic/src/main/java/io/actor4j/core/ActorRuntime.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2025, David A. Bauer. All rights reserved. 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 io.actor4j.core; 17 | 18 | import io.actor4j.core.config.ActorSystemConfig; 19 | 20 | public class ActorRuntime { 21 | public static ActorSystemFactory factory() { 22 | return ClassicActorRuntime.factory(); 23 | } 24 | 25 | public static ActorSystem create() { 26 | return ClassicActorRuntime.create(); 27 | } 28 | 29 | public static ActorSystem create(String name) { 30 | return ClassicActorRuntime.create(name); 31 | } 32 | 33 | public static ActorSystem create(ActorSystemConfig config) { 34 | return ClassicActorRuntime.create(config); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /actor4j-core-runtime-classic/src/main/java/io/actor4j/core/ActorServiceRuntime.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2025, David A. Bauer. All rights reserved. 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 io.actor4j.core; 17 | 18 | import io.actor4j.core.config.ActorSystemConfig; 19 | 20 | public class ActorServiceRuntime { 21 | public static ActorSystemFactory factory() { 22 | return ClassicActorServiceRuntime.factory(); 23 | } 24 | 25 | public static ActorService create() { 26 | return ClassicActorServiceRuntime.create(); 27 | } 28 | 29 | public static ActorService create(String name) { 30 | return ClassicActorServiceRuntime.create(name); 31 | } 32 | 33 | public static ActorService create(ActorSystemConfig config) { 34 | return ClassicActorServiceRuntime.create(config); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /actor4j-core-runtime-classic/src/main/java/io/actor4j/core/ClassicActorRuntime.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 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 io.actor4j.core; 17 | 18 | import io.actor4j.core.config.ActorSystemConfig; 19 | import io.actor4j.core.runtime.classic.ClassicDefaultActorSystemImpl; 20 | 21 | public class ClassicActorRuntime { 22 | public static ActorSystemFactory factory() { 23 | return (c) -> new ClassicDefaultActorSystemImpl(ActorSystemConfig.builder(c).watchdogEnabled(false).build()); 24 | } 25 | 26 | public static ActorSystem create() { 27 | return create(ActorSystemConfig.create()); 28 | } 29 | 30 | public static ActorSystem create(String name) { 31 | return create(ActorSystemConfig.builder().name(name).build()); 32 | } 33 | 34 | public static ActorSystem create(ActorSystemConfig config) { 35 | return factory().apply(config); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /actor4j-core-runtime-classic/src/main/java/io/actor4j/core/ClassicActorServiceRuntime.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 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 io.actor4j.core; 17 | 18 | import io.actor4j.core.config.ActorServiceConfig; 19 | import io.actor4j.core.config.ActorSystemConfig; 20 | import io.actor4j.core.runtime.classic.ClassicDefaultActorSystemImpl; 21 | 22 | public class ClassicActorServiceRuntime { 23 | public static ActorSystemFactory factory() { 24 | return (c) -> new ClassicDefaultActorSystemImpl(ActorServiceConfig.builder(c).watchdogEnabled(false).build()); 25 | } 26 | 27 | public static ActorService create() { 28 | return create(ActorServiceConfig.create()); 29 | } 30 | 31 | public static ActorService create(String name) { 32 | return create(ActorServiceConfig.builder().name(name).build()); 33 | } 34 | 35 | public static ActorService create(ActorSystemConfig config) { 36 | return (ActorService)factory().apply(config!=null ? config : ActorServiceConfig.create()); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /actor4j-core-runtime-classic/src/main/java/io/actor4j/core/runtime/classic/ActorMessageDispatcherCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2024, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime.classic; 17 | 18 | public interface ActorMessageDispatcherCallback { 19 | public void dispatchFromThread(ClassicInternalActorCell cell); 20 | } 21 | -------------------------------------------------------------------------------- /actor4j-core-runtime-classic/src/main/java/io/actor4j/core/runtime/classic/ActorRunnableMetrics.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2025, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime.classic; 17 | 18 | import java.util.Queue; 19 | import java.util.concurrent.ConcurrentLinkedQueue; 20 | import java.util.concurrent.atomic.AtomicInteger; 21 | import java.util.concurrent.atomic.AtomicLong; 22 | 23 | public final class ActorRunnableMetrics { 24 | protected final long threadId; 25 | 26 | protected final AtomicLong counter; 27 | // protected final AtomicBoolean load; 28 | 29 | protected final AtomicInteger processingTimeSampleCount; 30 | protected final Queue processingTimeSamples; 31 | 32 | protected final AtomicInteger cellsProcessingTimeSampleCount; 33 | 34 | public ActorRunnableMetrics(long threadId) { 35 | super(); 36 | this.threadId = threadId; 37 | 38 | // load = new AtomicBoolean(false); 39 | counter = new AtomicLong(0); 40 | 41 | processingTimeSampleCount = new AtomicInteger(0); 42 | processingTimeSamples = new ConcurrentLinkedQueue<>(); 43 | 44 | cellsProcessingTimeSampleCount = new AtomicInteger(0); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /actor4j-core-runtime-classic/src/main/java/io/actor4j/core/runtime/classic/ClassicDefaultActorExecutorService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime.classic; 17 | 18 | import io.actor4j.core.runtime.ActorExecutorServiceImpl; 19 | import io.actor4j.core.runtime.ActorExecutionUnitPool; 20 | import io.actor4j.core.runtime.InternalActorRuntimeSystem; 21 | 22 | public class ClassicDefaultActorExecutorService extends ActorExecutorServiceImpl implements ClassicInternalActorExecutorService { 23 | public ClassicDefaultActorExecutorService(InternalActorRuntimeSystem system) { 24 | super(system); 25 | } 26 | 27 | @Override 28 | public ActorExecutionUnitPool createExecutionUnitPool() { 29 | return new ActorRunnablePool(system); 30 | } 31 | 32 | @Override 33 | public ActorRunnablePool getRunnablePool() { 34 | return (ActorRunnablePool)executionUnitPool; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /actor4j-core-runtime-classic/src/main/java/io/actor4j/core/runtime/classic/ClassicInternalActorCell.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime.classic; 17 | 18 | import java.util.Queue; 19 | import java.util.concurrent.atomic.AtomicBoolean; 20 | 21 | import io.actor4j.core.messages.ActorMessage; 22 | import io.actor4j.core.runtime.InternalActorCell; 23 | 24 | public interface ClassicInternalActorCell extends InternalActorCell { 25 | public Queue> directiveQueue(); 26 | public Queue> outerQueue(); 27 | 28 | public default boolean hasMessage() { 29 | return 30 | !directiveQueue().isEmpty() || 31 | !outerQueue().isEmpty(); 32 | } 33 | 34 | public AtomicBoolean isScheduled(); 35 | public boolean aquireAsScheduled(); 36 | } 37 | -------------------------------------------------------------------------------- /actor4j-core-runtime-classic/src/main/java/io/actor4j/core/runtime/classic/ClassicInternalActorExecutorService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime.classic; 17 | 18 | import io.actor4j.core.runtime.ActorExecutorService; 19 | 20 | public interface ClassicInternalActorExecutorService extends ActorExecutorService { 21 | public ActorRunnablePool getRunnablePool(); 22 | } 23 | -------------------------------------------------------------------------------- /actor4j-core-runtime-classic/src/main/java/io/actor4j/core/runtime/classic/DefaultActorRunnable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime.classic; 17 | 18 | import io.actor4j.core.messages.ActorMessage; 19 | import io.actor4j.core.runtime.InternalActorSystem; 20 | 21 | public class DefaultActorRunnable extends ActorRunnable { 22 | public DefaultActorRunnable(InternalActorSystem system) { 23 | super(system); 24 | } 25 | 26 | @Override 27 | public void onRun(ClassicInternalActorCell cell) { 28 | int hasDirective = 0; 29 | int hasNextOuter = 0; 30 | 31 | ActorMessage msg = null; 32 | for (; (msg=cell.directiveQueue().poll())!=null; hasDirective++) 33 | faultToleranceMethod(msg, cell); 34 | 35 | for (; hasNextOuter metricsMap) { 26 | super(pool); 27 | 28 | metricsMap.put(threadId(), new ActorRunnableMetrics(threadId())); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /actor4j-core-runtime-extended/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | -------------------------------------------------------------------------------- /actor4j-core-runtime-extended/doc/Readme.txt: -------------------------------------------------------------------------------- 1 | Alternative to MpscLinkedQueue -> org.agrona.concurrent.ManyToOneConcurrentLinkedQueue -------------------------------------------------------------------------------- /actor4j-core-runtime-extended/src/main/java/io/actor4j/core/XActorRuntime.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2024, David A. Bauer. All rights reserved. 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 io.actor4j.core; 17 | 18 | import io.actor4j.core.config.XActorSystemConfig; 19 | import io.actor4j.core.runtime.extended.XDefaultActorSystemImpl; 20 | 21 | public class XActorRuntime { 22 | public static ActorSystemFactory factory() { 23 | return (c) -> new XDefaultActorSystemImpl((XActorSystemConfig)c); 24 | } 25 | 26 | public static ActorSystem create() { 27 | return create(XActorSystemConfig.create()); 28 | } 29 | 30 | public static ActorSystem create(String name) { 31 | return create(XActorSystemConfig.builder().name(name).build()); 32 | } 33 | 34 | public static ActorSystem create(XActorSystemConfig config) { 35 | return factory().apply(config); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /actor4j-core-runtime-extended/src/main/java/io/actor4j/core/XActorServiceRuntime.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2024, David A. Bauer. All rights reserved. 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 io.actor4j.core; 17 | 18 | import io.actor4j.core.config.XActorServiceConfig; 19 | import io.actor4j.core.runtime.extended.XDefaultActorSystemImpl; 20 | 21 | public class XActorServiceRuntime { 22 | public static ActorSystemFactory factory() { 23 | return (c) -> new XDefaultActorSystemImpl((XActorServiceConfig)c); 24 | } 25 | 26 | public static ActorSystem create() { 27 | return create(XActorServiceConfig.create()); 28 | } 29 | 30 | public static ActorSystem create(String name) { 31 | return create(XActorServiceConfig.builder().name(name).build()); 32 | } 33 | 34 | public static ActorSystem create(XActorServiceConfig config) { 35 | return factory().apply(config); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /actor4j-core-runtime-extended/src/main/java/io/actor4j/core/XActorSystem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2021, David A. Bauer. All rights reserved. 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 io.actor4j.core; 17 | 18 | import io.actor4j.core.config.ActorSystemConfig; 19 | import io.actor4j.core.config.XActorSystemConfig; 20 | import io.actor4j.core.runtime.extended.XDefaultActorSystemImpl; 21 | 22 | public interface XActorSystem extends ActorSystem { 23 | public static XActorSystem create() { 24 | return create(XActorSystemConfig.builder().build()); 25 | } 26 | 27 | public static XActorSystem create(String name) { 28 | return create(XActorSystemConfig.builder().name(name).build()); 29 | } 30 | 31 | public static XActorSystem create(XActorSystemConfig config) { 32 | return new XDefaultActorSystemImpl(config); 33 | } 34 | 35 | @Deprecated 36 | @Override 37 | public default boolean setConfig(ActorSystemConfig config) { 38 | return false; 39 | } 40 | 41 | public boolean setConfig(XActorSystemConfig config); 42 | 43 | // public List addActor(int instances, Class clazz, Object... args) throws ActorInitializationException; 44 | // public ActorId addActor(Class clazz, Object... args) throws ActorInitializationException; 45 | } 46 | -------------------------------------------------------------------------------- /actor4j-core-runtime-extended/src/main/java/io/actor4j/core/actors/ActorWithRxStash.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2024, David A. Bauer. All rights reserved. 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 io.actor4j.core.actors; 17 | 18 | import java.util.LinkedList; 19 | 20 | import io.actor4j.core.messages.ActorMessage; 21 | import io.actor4j.core.utils.ActorMessageFlowable; 22 | import io.reactivex.rxjava3.core.Flowable; 23 | 24 | public abstract class ActorWithRxStash extends Actor { 25 | protected Flowable> rxStash; 26 | 27 | public ActorWithRxStash() { 28 | this(null); 29 | } 30 | 31 | public ActorWithRxStash(String name) { 32 | super(name); 33 | 34 | stash = new LinkedList<>(); 35 | rxStash = ActorMessageFlowable.getMessages(stash); 36 | } 37 | 38 | public ActorMessage unstash() { 39 | return stash.poll(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /actor4j-core-runtime-extended/src/main/java/io/actor4j/core/actors/ConcurrentPseudoActorWithRx.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2024, David A. Bauer. All rights reserved. 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 io.actor4j.core.actors; 17 | 18 | import io.actor4j.core.ActorSystem; 19 | import io.actor4j.core.messages.ActorMessage; 20 | import io.actor4j.core.utils.ActorMessageFlowable; 21 | import io.reactivex.rxjava3.core.Flowable; 22 | 23 | public abstract class ConcurrentPseudoActorWithRx extends ConcurrentPseudoActor { 24 | public ConcurrentPseudoActorWithRx(String name, ActorSystem system) { 25 | this(name, system, false); 26 | } 27 | 28 | public ConcurrentPseudoActorWithRx(ActorSystem system, boolean blocking) { 29 | this(null, system, blocking); 30 | } 31 | 32 | public ConcurrentPseudoActorWithRx(String name, ActorSystem system, boolean blocking) { 33 | super(); 34 | 35 | actor = new PseudoActorWithRx(name, system, blocking) { 36 | @Override 37 | public void receive(ActorMessage message) { 38 | ConcurrentPseudoActorWithRx.this.receive(message); 39 | } 40 | }; 41 | } 42 | 43 | public Flowable> runWithRx() { 44 | return ActorMessageFlowable.getMessages(getOuterQueue()); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /actor4j-core-runtime-extended/src/main/java/io/actor4j/core/logging/XActorLogger.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2019, David A. Bauer. All rights reserved. 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 io.actor4j.core.logging; 17 | 18 | import org.slf4j.Logger; 19 | import org.slf4j.LoggerFactory; 20 | 21 | public class XActorLogger { 22 | public static Logger logger; 23 | 24 | static { 25 | logger = LoggerFactory.getLogger(XActorLogger.class); 26 | } 27 | 28 | public static Logger logger() { 29 | return logger; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /actor4j-core-runtime-extended/src/main/java/io/actor4j/core/runtime/extended/di/ConstructorInjector.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2021, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime.extended.di; 17 | 18 | public class ConstructorInjector { 19 | protected Object[] params; 20 | 21 | public ConstructorInjector() { 22 | super(); 23 | } 24 | 25 | public Object[] getParams() { 26 | return params; 27 | } 28 | 29 | public void setParams(Object[] params) { 30 | this.params = params; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /actor4j-core-runtime-extended/src/main/java/io/actor4j/core/runtime/extended/di/DIMapEntry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2021, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime.extended.di; 17 | 18 | import io.actor4j.core.runtime.di.FactoryInjector; 19 | 20 | public class DIMapEntry { 21 | protected Class base; 22 | protected ConstructorInjector constructorInjector; 23 | protected FactoryInjector factoryInjector; 24 | 25 | public DIMapEntry() { 26 | constructorInjector = new ConstructorInjector(); 27 | } 28 | 29 | public Class getBase() { 30 | return base; 31 | } 32 | 33 | public void setBase(Class base) { 34 | this.base = base; 35 | } 36 | 37 | public ConstructorInjector getConstructorInjector() { 38 | return constructorInjector; 39 | } 40 | 41 | public void setConstructorInjector(ConstructorInjector constructorInjector) { 42 | this.constructorInjector = constructorInjector; 43 | } 44 | 45 | public FactoryInjector getFactoryInjector() { 46 | return factoryInjector; 47 | } 48 | 49 | public void setFactoryInjector(FactoryInjector factoryInjector) { 50 | this.factoryInjector = factoryInjector; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /actor4j-core-runtime-extended/src/main/java/io/actor4j/core/utils/Utils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2021, David A. Bauer. All rights reserved. 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 io.actor4j.core.utils; 17 | 18 | import java.util.HashMap; 19 | import java.util.Map; 20 | 21 | public final class Utils { 22 | private static Map, Class> PRIMITIVE_MAPPERS; 23 | 24 | public static boolean isPrimitive(Class type) { 25 | return type.isPrimitive(); 26 | } 27 | 28 | public static Class getPrimitiveWrapper(Class type) { 29 | return PRIMITIVE_MAPPERS.get(type); 30 | } 31 | 32 | static { 33 | PRIMITIVE_MAPPERS = new HashMap<>(); 34 | PRIMITIVE_MAPPERS.put(byte.class, Byte.class); 35 | PRIMITIVE_MAPPERS.put(short.class, Short.class); 36 | PRIMITIVE_MAPPERS.put(int.class, Integer.class); 37 | PRIMITIVE_MAPPERS.put(long.class, Long.class); 38 | PRIMITIVE_MAPPERS.put(float.class, Float.class); 39 | PRIMITIVE_MAPPERS.put(double.class, Double.class); 40 | PRIMITIVE_MAPPERS.put(char.class, Character.class); 41 | PRIMITIVE_MAPPERS.put(String.class, String.class); 42 | PRIMITIVE_MAPPERS.put(boolean.class, Boolean.class); 43 | PRIMITIVE_MAPPERS.put(Void.class, Void.class); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /actor4j-core-runtime-extended/src/main/resources/log4j2.properties: -------------------------------------------------------------------------------- 1 | appender.system.type = Console 2 | appender.system.name = system 3 | appender.system.layout.type = PatternLayout 4 | appender.system.layout.pattern = [%-5p] %d{yyyy-MM-dd HH:mm:ss.SSS} [SYSTEM] [%t] %-40C -> %L [MESSAGE] %m%n 5 | 6 | appender.user.type = Console 7 | appender.user.name = user 8 | appender.user.layout.type = PatternLayout 9 | appender.user.layout.pattern = [%-5p] %d{yyyy-MM-dd HH:mm:ss.SSS} [USER ] [%t] %-40C -> %L [MESSAGE] %m%n 10 | 11 | rootLogger.level = error 12 | rootLogger.appenderRef.rootLogger.ref = system 13 | 14 | logger.user.name = io.actor4j.core.logging 15 | logger.user.level = error 16 | logger.user.additivity = false 17 | logger.user.appenderRef.user.ref = user -------------------------------------------------------------------------------- /actor4j-core-runtime-loom/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | -------------------------------------------------------------------------------- /actor4j-core-runtime-loom/pom.xml: -------------------------------------------------------------------------------- 1 | 4 | 4.0.0 5 | 6 | io.actor4j 7 | actor4j-core 8 | ${revision} 9 | 10 | actor4j-core-runtime-loom 11 | jar 12 | 13 | ${project.groupId}:${project.artifactId} 14 | Actor4j is an actor-oriented Java framework. 15 | https://github.com/relvaner/actor4j-core 16 | 2015 17 | 18 | 19 | 20 | The Apache License, Version 2.0 21 | http://www.apache.org/licenses/LICENSE-2.0.txt 22 | repo 23 | 24 | 25 | 26 | 27 | 28 | David A. Bauer 29 | relvaner.github@gmail.com 30 | 31 | 32 | 33 | 34 | 35 | io.actor4j 36 | actor4j-core-runtime-base 37 | ${revision} 38 | 39 | 40 | 41 | org.junit.vintage 42 | junit-vintage-engine 43 | ${junit.version} 44 | test 45 | 46 | 47 | -------------------------------------------------------------------------------- /actor4j-core-runtime-loom/src/main/java/io/actor4j/core/ActorRuntime.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2025, David A. Bauer. All rights reserved. 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 io.actor4j.core; 17 | 18 | import io.actor4j.core.config.ActorSystemConfig; 19 | 20 | public class ActorRuntime { 21 | public static ActorSystemFactory factory() { 22 | return VirtualActorRuntime.factory(); 23 | } 24 | 25 | public static ActorSystem create() { 26 | return VirtualActorRuntime.create(); 27 | } 28 | 29 | public static ActorSystem create(String name) { 30 | return VirtualActorRuntime.create(name); 31 | } 32 | 33 | public static ActorSystem create(ActorSystemConfig config) { 34 | return VirtualActorRuntime.create(config); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /actor4j-core-runtime-loom/src/main/java/io/actor4j/core/ActorServiceRuntime.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 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 io.actor4j.core; 17 | 18 | import io.actor4j.core.config.ActorSystemConfig; 19 | 20 | public class ActorServiceRuntime { 21 | public static ActorSystemFactory factory() { 22 | return VirtualActorServiceRuntime.factory(); 23 | } 24 | 25 | public static ActorService create() { 26 | return VirtualActorServiceRuntime.create(); 27 | } 28 | 29 | public static ActorService create(String name) { 30 | return VirtualActorServiceRuntime.create(name); 31 | } 32 | 33 | public static ActorService create(ActorSystemConfig config) { 34 | return VirtualActorServiceRuntime.create(config); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /actor4j-core-runtime-loom/src/main/java/io/actor4j/core/VirtualActorRuntime.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 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 io.actor4j.core; 17 | 18 | import io.actor4j.core.config.ActorSystemConfig; 19 | import io.actor4j.core.runtime.loom.DefaultVirtualActorSystemImpl; 20 | 21 | public class VirtualActorRuntime { 22 | public static ActorSystemFactory factory() { 23 | return (config) -> new DefaultVirtualActorSystemImpl(ActorSystemConfig.builder(config).watchdogEnabled(false).build()); 24 | } 25 | 26 | public static ActorSystem create() { 27 | return create(ActorSystemConfig.create()); 28 | } 29 | 30 | public static ActorSystem create(String name) { 31 | return create(ActorSystemConfig.builder().name(name).build()); 32 | } 33 | 34 | public static ActorSystem create(ActorSystemConfig config) { 35 | return factory().apply(config); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /actor4j-core-runtime-loom/src/main/java/io/actor4j/core/VirtualActorServiceRuntime.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 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 io.actor4j.core; 17 | 18 | import io.actor4j.core.config.ActorServiceConfig; 19 | import io.actor4j.core.config.ActorSystemConfig; 20 | import io.actor4j.core.runtime.loom.DefaultVirtualActorSystemImpl; 21 | 22 | public class VirtualActorServiceRuntime { 23 | public static ActorSystemFactory factory() { 24 | return (config) -> new DefaultVirtualActorSystemImpl(ActorServiceConfig.builder(config).watchdogEnabled(false).build()); 25 | } 26 | 27 | public static ActorService create() { 28 | return create(ActorServiceConfig.create()); 29 | } 30 | 31 | public static ActorService create(String name) { 32 | return create(ActorServiceConfig.builder().name(name).build()); 33 | } 34 | 35 | public static ActorService create(ActorSystemConfig config) { 36 | return (ActorService)factory().apply(config!=null ? config : ActorServiceConfig.create()); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /actor4j-core-runtime-loom/src/main/java/io/actor4j/core/runtime/loom/DefaultVirtualActorRunnablePoolHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime.loom; 17 | 18 | import io.actor4j.core.runtime.InternalActorCell; 19 | import io.actor4j.core.runtime.InternalActorSystem; 20 | 21 | public class DefaultVirtualActorRunnablePoolHandler extends VirtualActorRunnablePoolHandler { 22 | public DefaultVirtualActorRunnablePoolHandler(InternalActorSystem system, VirtualActorRunnablePool virtualActorRunnablePool) { 23 | super(system, virtualActorRunnablePool); 24 | } 25 | 26 | @Override 27 | public VirtualActorRunnable createVirtualActorRunnable(InternalActorSystem system, InternalActorCell cell, Runnable onTermination) { 28 | return new DefaultVirtualActorRunnable(system, cell, onTermination); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /actor4j-core-runtime-loom/src/main/java/io/actor4j/core/runtime/loom/InternalVirtualActorExecutorService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime.loom; 17 | 18 | import io.actor4j.core.runtime.ActorExecutorService; 19 | 20 | public interface InternalVirtualActorExecutorService extends ActorExecutorService { 21 | public VirtualActorRunnablePool getVirtualActorResourceRunnablePool(); 22 | public VirtualActorRunnablePool getVirtualActorRunnablePool(); 23 | } 24 | -------------------------------------------------------------------------------- /actor4j-core-runtime-loom/src/main/java/io/actor4j/core/runtime/loom/VirtualActorRunnableMetrics.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2025, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime.loom; 17 | 18 | import java.util.Queue; 19 | import java.util.concurrent.ConcurrentLinkedQueue; 20 | import java.util.concurrent.atomic.AtomicInteger; 21 | import java.util.concurrent.atomic.AtomicLong; 22 | 23 | public final class VirtualActorRunnableMetrics { 24 | protected final AtomicLong counter; 25 | // protected final AtomicBoolean load; 26 | 27 | protected final AtomicInteger processingTimeSampleCount; 28 | protected final Queue processingTimeSamples; 29 | 30 | protected final AtomicInteger cellsProcessingTimeSampleCount; 31 | 32 | static { 33 | 34 | } 35 | 36 | public VirtualActorRunnableMetrics() { 37 | super(); 38 | 39 | // load = new AtomicBoolean(false); 40 | counter = new AtomicLong(0); 41 | 42 | processingTimeSampleCount = new AtomicInteger(0); 43 | processingTimeSamples = new ConcurrentLinkedQueue<>(); 44 | 45 | cellsProcessingTimeSampleCount = new AtomicInteger(0); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /actor4j-core-runtime-loom/src/main/java/io/actor4j/core/runtime/loom/VirtualActorRunnablePoolHandlerFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime.loom; 17 | 18 | import java.util.function.Function; 19 | 20 | public interface VirtualActorRunnablePoolHandlerFactory extends Function { 21 | } 22 | -------------------------------------------------------------------------------- /actor4j-core-runtime-loom/src/main/java/io/actor4j/core/runtime/loom/VirtualBaseActorCell.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2025, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime.loom; 17 | 18 | import io.actor4j.core.actors.Actor; 19 | import io.actor4j.core.runtime.BaseActorCell; 20 | import io.actor4j.core.runtime.InternalActorSystem; 21 | 22 | public class VirtualBaseActorCell extends BaseActorCell implements VirtualInternalActorCell { 23 | protected VirtualActorRunnable virtualRunnable; 24 | 25 | public VirtualBaseActorCell(InternalActorSystem system, Actor actor) { 26 | super(system, actor); 27 | } 28 | 29 | public VirtualActorRunnable getVirtualRunnable() { 30 | return virtualRunnable; 31 | } 32 | 33 | public void setVirtualRunnable(VirtualActorRunnable virtualRunnable) { 34 | this.virtualRunnable = virtualRunnable; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /actor4j-core-runtime-loom/src/main/java/io/actor4j/core/runtime/loom/VirtualInternalActorCell.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2025, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime.loom; 17 | 18 | public interface VirtualInternalActorCell { 19 | public VirtualActorRunnable getVirtualRunnable(); 20 | public void setVirtualRunnable(VirtualActorRunnable virtualRunnable); 21 | } 22 | -------------------------------------------------------------------------------- /actor4j-core-runtime-loom/src/main/java/io/actor4j/core/runtime/loom/VirtualPodActorCell.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2025, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime.loom; 17 | 18 | import io.actor4j.core.actors.Actor; 19 | import io.actor4j.core.runtime.InternalActorSystem; 20 | import io.actor4j.core.runtime.PodActorCell; 21 | 22 | public class VirtualPodActorCell extends PodActorCell implements VirtualInternalActorCell { 23 | protected VirtualActorRunnable virtualRunnable; 24 | 25 | public VirtualPodActorCell(InternalActorSystem system, Actor actor) { 26 | super(system, actor); 27 | } 28 | 29 | public VirtualActorRunnable getVirtualRunnable() { 30 | return virtualRunnable; 31 | } 32 | 33 | public void setVirtualRunnable(VirtualActorRunnable virtualRunnable) { 34 | this.virtualRunnable = virtualRunnable; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /actor4j-core-runtime/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | -------------------------------------------------------------------------------- /actor4j-core-runtime/pom.xml: -------------------------------------------------------------------------------- 1 | 4 | 4.0.0 5 | 6 | io.actor4j 7 | actor4j-core 8 | ${revision} 9 | 10 | actor4j-core-runtime 11 | jar 12 | 13 | ${project.groupId}:${project.artifactId} 14 | Actor4j is an actor-oriented Java framework. 15 | https://github.com/relvaner/actor4j-core 16 | 2015 17 | 18 | 19 | 20 | The Apache License, Version 2.0 21 | http://www.apache.org/licenses/LICENSE-2.0.txt 22 | repo 23 | 24 | 25 | 26 | 27 | 28 | David A. Bauer 29 | relvaner.github@gmail.com 30 | 31 | 32 | 33 | 34 | 35 | io.actor4j 36 | actor4j-core-runtime-base 37 | ${revision} 38 | 39 | 40 | 41 | org.junit.vintage 42 | junit-vintage-engine 43 | ${junit.version} 44 | test 45 | 46 | 47 | -------------------------------------------------------------------------------- /actor4j-core-runtime/src/main/java/io/actor4j/core/ActorRuntime.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 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 io.actor4j.core; 17 | 18 | import io.actor4j.core.config.ActorSystemConfig; 19 | import io.actor4j.core.runtime.DefaultActorSystemImpl; 20 | 21 | public class ActorRuntime { 22 | public static ActorSystemFactory factory() { 23 | return (c) -> new DefaultActorSystemImpl(c); 24 | } 25 | 26 | public static ActorSystem create() { 27 | return create(ActorSystemConfig.create()); 28 | } 29 | 30 | public static ActorSystem create(String name) { 31 | return create(ActorSystemConfig.builder().name(name).build()); 32 | } 33 | 34 | public static ActorSystem create(ActorSystemConfig config) { 35 | return factory().apply(config); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /actor4j-core-runtime/src/main/java/io/actor4j/core/ActorServiceRuntime.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 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 io.actor4j.core; 17 | 18 | import io.actor4j.core.config.ActorServiceConfig; 19 | import io.actor4j.core.config.ActorSystemConfig; 20 | import io.actor4j.core.runtime.DefaultActorSystemImpl; 21 | 22 | public class ActorServiceRuntime { 23 | public static ActorSystemFactory factory() { 24 | return (c) -> new DefaultActorSystemImpl(c); 25 | } 26 | 27 | public static ActorService create() { 28 | return create(ActorServiceConfig.create()); 29 | } 30 | 31 | public static ActorService create(String name) { 32 | return create(ActorServiceConfig.builder().name(name).build()); 33 | } 34 | 35 | public static ActorService create(ActorSystemConfig config) { 36 | return (ActorService)factory().apply(config!=null ? config : ActorServiceConfig.create()); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /actor4j-core-runtime/src/main/java/io/actor4j/core/runtime/ActorThreadFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2021, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime; 17 | 18 | import io.actor4j.core.function.TriFunction; 19 | 20 | public interface ActorThreadFactory extends TriFunction { 21 | } 22 | -------------------------------------------------------------------------------- /actor4j-core-runtime/src/main/java/io/actor4j/core/runtime/DefaultActorExecutorService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime; 17 | 18 | public class DefaultActorExecutorService extends ActorExecutorServiceImpl implements DefaultInternalActorExecutorService { 19 | public DefaultActorExecutorService(InternalActorRuntimeSystem system) { 20 | super(system); 21 | } 22 | 23 | public ActorExecutionUnitPool createExecutionUnitPool() { 24 | return new ActorThreadPool((DefaultInternalActorRuntimeSystem)system); 25 | } 26 | 27 | @Override 28 | public ActorThreadPool getThreadPool() { 29 | return (ActorThreadPool)executionUnitPool; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /actor4j-core-runtime/src/main/java/io/actor4j/core/runtime/DefaultActorThreadFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2021, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime; 17 | 18 | public class DefaultActorThreadFactory extends DefaultThreadFactory { 19 | 20 | public DefaultActorThreadFactory(String name) { 21 | super(name); 22 | } 23 | 24 | public ActorThread newThread(DefaultInternalActorRuntimeSystem system) { 25 | ActorThread t = system.getActorThreadFactory().apply(group, name + "-worker-thread-" + index.getAndIncrement(), system); 26 | 27 | if (t.isDaemon()) 28 | t.setDaemon(false); 29 | if (t.getPriority() != Thread.MAX_PRIORITY) 30 | t.setPriority(Thread.MAX_PRIORITY); 31 | 32 | return t; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /actor4j-core-runtime/src/main/java/io/actor4j/core/runtime/DefaultInternalActorExecutorService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime; 17 | 18 | public interface DefaultInternalActorExecutorService extends InternalActorExecutorService { 19 | public ActorThreadPool getThreadPool(); 20 | } 21 | -------------------------------------------------------------------------------- /actor4j-core-runtime/src/main/java/io/actor4j/core/runtime/DefaultInternalActorRuntimeSystem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime; 17 | 18 | public interface DefaultInternalActorRuntimeSystem extends InternalActorRuntimeSystem { 19 | public ActorThreadFactory getActorThreadFactory(); 20 | } 21 | -------------------------------------------------------------------------------- /actor4j-core-runtime/src/main/java/io/actor4j/core/runtime/DefaultUnboundedActorThread.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2020, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime; 17 | 18 | import java.util.ArrayDeque; 19 | import java.util.LinkedList; 20 | import java.util.concurrent.ConcurrentLinkedQueue; 21 | import java.util.concurrent.PriorityBlockingQueue; 22 | 23 | public class DefaultUnboundedActorThread extends DefaultActorThread { 24 | public DefaultUnboundedActorThread(ThreadGroup group, String name, InternalActorSystem system) { 25 | super(group, name, system); 26 | } 27 | 28 | @Override 29 | public void configQueues() { 30 | directiveQueue = new ConcurrentLinkedQueue<>(); /* unbounded */ 31 | priorityQueue = new PriorityBlockingQueue<>(queueSize); /* unbounded */ 32 | 33 | serverQueueL2 = new ConcurrentLinkedQueue<>(); /* unbounded */ 34 | serverQueueL1 = new ArrayDeque<>(bufferQueueSize); /* unbounded */ 35 | 36 | outerQueueL2 = new ConcurrentLinkedQueue<>(); /* unbounded */ 37 | outerQueueL1 = new ArrayDeque<>(bufferQueueSize); /* unbounded */ 38 | 39 | innerQueue = new LinkedList<>(); /* unbounded */ 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /actor4j-core-sdk/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | -------------------------------------------------------------------------------- /actor4j-core-sdk/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | io.actor4j 5 | actor4j-core 6 | ${revision} 7 | 8 | actor4j-core-sdk 9 | jar 10 | 11 | ${project.groupId}:${project.artifactId} 12 | Actor4j is an actor-oriented Java framework. 13 | https://github.com/relvaner/actor4j-core 14 | 2015 15 | 16 | 17 | 18 | The Apache License, Version 2.0 19 | http://www.apache.org/licenses/LICENSE-2.0.txt 20 | repo 21 | 22 | 23 | 24 | 25 | 26 | David A. Bauer 27 | relvaner.github@gmail.com 28 | 29 | 30 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/ActorPodService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2020, David A. Bauer. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.actor4j.core; 18 | 19 | import io.actor4j.core.id.ActorId; 20 | import io.actor4j.core.pods.PodContext; 21 | import io.actor4j.core.utils.PodActorFactory; 22 | 23 | public interface ActorPodService { 24 | public ActorId addPodActor(PodActorFactory factory, PodContext context); 25 | } 26 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/ActorSystemFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2019, David A. Bauer. All rights reserved. 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 io.actor4j.core; 17 | 18 | import java.util.function.Function; 19 | 20 | import io.actor4j.core.config.ActorSystemConfig; 21 | 22 | public interface ActorSystemFactory extends Function{ 23 | } 24 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/EmbeddedActorCell.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 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 io.actor4j.core; 17 | 18 | import java.util.UUID; 19 | import java.util.function.Predicate; 20 | 21 | import io.actor4j.core.actors.ActorRef; 22 | import io.actor4j.core.id.ActorId; 23 | import io.actor4j.core.messages.ActorMessage; 24 | 25 | public interface EmbeddedActorCell extends ActorId { 26 | public ActorRef host(); 27 | 28 | public ActorId localId(); 29 | public UUID globalId(); 30 | 31 | public ActorId getId(); 32 | public ActorId getParent(); 33 | 34 | public void become(Predicate> behaviour, boolean replace); 35 | public void unbecome(); 36 | public void unbecomeAll(); 37 | 38 | public void send(ActorMessage message); 39 | 40 | public void preStart(); 41 | public void restart(Exception reason); 42 | public void stop(); 43 | } 44 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/actors/ActorDistributedGroupMember.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2017, David A. Bauer. All rights reserved. 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 io.actor4j.core.actors; 17 | 18 | import java.util.UUID; 19 | 20 | public interface ActorDistributedGroupMember { 21 | public UUID getDistributedGroupId(); 22 | } 23 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/actors/ActorGroupMember.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2017, David A. Bauer. All rights reserved. 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 io.actor4j.core.actors; 17 | 18 | import java.util.UUID; 19 | 20 | public interface ActorGroupMember { 21 | public UUID getGroupId(); 22 | } 23 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/actors/ActorIgnoreDistributedGroupMember.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2020, David A. Bauer. All rights reserved. 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 io.actor4j.core.actors; 17 | 18 | public interface ActorIgnoreDistributedGroupMember { 19 | 20 | } 21 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/actors/ActorRegionMember.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2024, David A. Bauer. All rights reserved. 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 io.actor4j.core.actors; 17 | 18 | import java.util.UUID; 19 | 20 | public interface ActorRegionMember extends ActorGroupMember { 21 | public default UUID getRegionId() { 22 | return getGroupId(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/actors/ActorVersionNumber.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2021, David A. Bauer. All rights reserved. 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 io.actor4j.core.actors; 17 | 18 | public interface ActorVersionNumber { 19 | public String versionNumber(); 20 | } 21 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/actors/ActorWithBothGroups.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2020, David A. Bauer. All rights reserved. 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 io.actor4j.core.actors; 17 | 18 | import io.actor4j.core.utils.ActorGroup; 19 | 20 | public abstract class ActorWithBothGroups extends ActorWithDistributedGroup implements ActorGroupMember { 21 | public ActorWithBothGroups(ActorGroup group) { 22 | super(group); 23 | } 24 | 25 | public ActorWithBothGroups(String name, ActorGroup group) { 26 | super(name, group); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/actors/ActorWithDistributedGroup.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2017, David A. Bauer. All rights reserved. 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 io.actor4j.core.actors; 17 | 18 | import java.util.UUID; 19 | 20 | import io.actor4j.core.utils.ActorGroup; 21 | 22 | public abstract class ActorWithDistributedGroup extends Actor implements ActorDistributedGroupMember { 23 | protected UUID distributedGroupId; 24 | 25 | public ActorWithDistributedGroup(ActorGroup group) { 26 | this(null, group); 27 | } 28 | 29 | public ActorWithDistributedGroup(String name, ActorGroup group) { 30 | super(name); 31 | 32 | distributedGroupId = group.getId(); 33 | } 34 | 35 | @Override 36 | public UUID getDistributedGroupId() { 37 | return distributedGroupId; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/actors/ActorWithGroup.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2017, David A. Bauer. All rights reserved. 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 io.actor4j.core.actors; 17 | 18 | import java.util.UUID; 19 | 20 | import io.actor4j.core.utils.ActorGroup; 21 | 22 | public abstract class ActorWithGroup extends Actor implements ActorGroupMember { 23 | protected UUID groupId; 24 | 25 | public ActorWithGroup(ActorGroup group) { 26 | this(null, group); 27 | } 28 | 29 | public ActorWithGroup(String name, ActorGroup group) { 30 | super(name); 31 | 32 | groupId = group.getId(); 33 | } 34 | 35 | @Override 36 | public UUID getGroupId() { 37 | return groupId; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/actors/EmbeddedActorRef.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 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 io.actor4j.core.actors; 17 | 18 | import io.actor4j.core.id.ActorId; 19 | import io.actor4j.core.messages.ActorMessage; 20 | 21 | public interface EmbeddedActorRef { 22 | public ActorRef host(); 23 | 24 | public String getName(); 25 | public ActorId getId(); 26 | public ActorId self(); 27 | public ActorId getParent(); 28 | 29 | public void send(ActorMessage message); 30 | public void send(ActorMessage message, ActorId dest); 31 | public void tell(T value, int tag, ActorId dest); 32 | public void forward(ActorMessage message, ActorId dest); 33 | } 34 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/actors/PersistenceId.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2017, David A. Bauer. All rights reserved. 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 io.actor4j.core.actors; 17 | 18 | import java.util.UUID; 19 | 20 | public interface PersistenceId { 21 | public UUID persistenceId(); 22 | } 23 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/actors/PersistentActor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2017, David A. Bauer. All rights reserved. 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 io.actor4j.core.actors; 17 | 18 | import static io.actor4j.core.runtime.protocols.ActorProtocolTag.INTERNAL_RECOVER; 19 | 20 | import java.util.function.Consumer; 21 | 22 | import io.actor4j.core.json.JsonObject; 23 | 24 | public abstract class PersistentActor extends Actor implements PersistenceId { 25 | public static final int RECOVER = INTERNAL_RECOVER; 26 | 27 | public PersistentActor() { 28 | super(); 29 | } 30 | 31 | public PersistentActor(String name) { 32 | super(name); 33 | } 34 | 35 | @SuppressWarnings("unchecked") 36 | public void persist(Consumer onSuccess, Consumer onFailure, E... events) { 37 | cell.persist(onSuccess, onFailure, events); 38 | } 39 | 40 | public void saveSnapshot(Consumer onSuccess, Consumer onFailure, S state) { 41 | cell.saveSnapshot(onSuccess, onFailure, state); 42 | } 43 | 44 | public void recover(JsonObject value) { 45 | // empty 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/actors/ResourceActor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2017, David A. Bauer. All rights reserved. 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 io.actor4j.core.actors; 17 | 18 | public abstract class ResourceActor extends Actor { 19 | protected final boolean stateful; 20 | protected final boolean bulk; 21 | 22 | public ResourceActor() { 23 | this(null, false, false); 24 | } 25 | 26 | public ResourceActor(String name) { 27 | this(name, false, false); 28 | } 29 | 30 | public ResourceActor(boolean stateful) { 31 | this(null, stateful, false); 32 | } 33 | 34 | public ResourceActor(String name, boolean stateful) { 35 | this(name, stateful, false); 36 | } 37 | 38 | public ResourceActor(String name, boolean stateful, boolean bulk) { 39 | super(name); 40 | this.stateful = stateful; 41 | this.bulk = bulk; 42 | } 43 | 44 | public boolean isStateful() { 45 | return stateful; 46 | } 47 | 48 | public boolean isBulk() { 49 | return bulk; 50 | } 51 | 52 | public void before() { 53 | // empty 54 | } 55 | 56 | public void after() { 57 | // empty 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/actors/SecondaryActor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2017, David A. Bauer. All rights reserved. 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 io.actor4j.core.actors; 17 | 18 | import static io.actor4j.core.actors.ActorWithCache.SUBSCRIBE_SECONDARY; 19 | 20 | import io.actor4j.core.id.ActorId; 21 | import io.actor4j.core.messages.ActorMessage; 22 | import io.actor4j.core.utils.ActorGroup; 23 | 24 | public abstract class SecondaryActor extends ActorWithDistributedGroup { 25 | protected /*final*/ ActorId primary; 26 | 27 | public SecondaryActor(ActorGroup group, ActorId primary) { 28 | this(null, group, primary); 29 | } 30 | 31 | public SecondaryActor(String name, ActorGroup group, ActorId primary) { 32 | super(name, group); 33 | this.primary = primary; 34 | } 35 | 36 | public void publish(ActorMessage message) { 37 | send(message, primary); 38 | } 39 | 40 | public void publish(T value, int tag) { 41 | tell(value, tag, primary); 42 | } 43 | 44 | public void subscribeAsSecondary() { 45 | tell(null, SUBSCRIBE_SECONDARY, primary); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/actors/StatelessActor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2017, David A. Bauer. All rights reserved. 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 io.actor4j.core.actors; 17 | 18 | import io.actor4j.core.utils.ActorGroup; 19 | 20 | public abstract class StatelessActor extends ActorWithDistributedGroup { 21 | 22 | public StatelessActor(ActorGroup group) { 23 | super(group); 24 | } 25 | 26 | public StatelessActor(String name, ActorGroup group) { 27 | super(name, group); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/config/ActorServiceConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2021, David A. Bauer. All rights reserved. 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 io.actor4j.core.config; 17 | 18 | public class ActorServiceConfig extends ActorSystemConfig { 19 | public static abstract class Builder extends ActorSystemConfig.Builder { 20 | public Builder() { 21 | super(); 22 | serverMode(); 23 | } 24 | 25 | public Builder(T config) { 26 | super(config); 27 | serverMode(); 28 | } 29 | } 30 | 31 | public ActorServiceConfig(Builder builder) { 32 | super(builder); 33 | } 34 | 35 | public static ActorServiceConfig create() { 36 | return new ActorServiceConfig(builder()); 37 | } 38 | 39 | public static Builder builder() { 40 | return new Builder() { 41 | @Override 42 | public ActorServiceConfig build() { 43 | return new ActorServiceConfig(this); 44 | } 45 | }; 46 | } 47 | 48 | public static Builder builder(ActorServiceConfig config) { 49 | return new Builder(config) { 50 | @Override 51 | public ActorServiceConfig build() { 52 | return new ActorServiceConfig(this); 53 | } 54 | }; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/exceptions/ActorInitializationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2017, David A. Bauer. All rights reserved. 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 io.actor4j.core.exceptions; 17 | 18 | public class ActorInitializationException extends RuntimeException { 19 | protected static final long serialVersionUID = -6130654059639276742L; 20 | 21 | public ActorInitializationException() { 22 | super("actor initialization failed"); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/exceptions/ActorKilledException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2017, David A. Bauer. All rights reserved. 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 io.actor4j.core.exceptions; 17 | 18 | public class ActorKilledException extends RuntimeException { 19 | protected static final long serialVersionUID = 5887686326593649655L; 20 | 21 | public ActorKilledException() { 22 | super("actor was killed"); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/exceptions/ActorResourceException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2017, David A. Bauer. All rights reserved. 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 io.actor4j.core.exceptions; 17 | 18 | public class ActorResourceException extends RuntimeException { 19 | protected static final long serialVersionUID = 8954823248417031086L; 20 | } 21 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/exceptions/ActorSystemConfigException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2017, David A. Bauer. All rights reserved. 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 io.actor4j.core.exceptions; 17 | 18 | public class ActorSystemConfigException extends RuntimeException { 19 | protected static final long serialVersionUID = -4944921391208119874L; 20 | 21 | public ActorSystemConfigException() { 22 | super("wrong configuration class"); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/function/Procedure.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2021, David A. Bauer. All rights reserved. 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 io.actor4j.core.function; 17 | 18 | @FunctionalInterface 19 | public interface Procedure { 20 | public void apply(); 21 | } 22 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/function/QuadConsumer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 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 io.actor4j.core.function; 17 | 18 | import java.util.Objects; 19 | 20 | @FunctionalInterface 21 | public interface QuadConsumer { 22 | void accept(T t, U u, V v, W w); 23 | 24 | default QuadConsumer andThen(QuadConsumer after) { 25 | Objects.requireNonNull(after); 26 | 27 | return (t, u, v, w) -> { 28 | accept(t, u, v, w); 29 | after.accept(t, u, v, w); 30 | }; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/function/QuintConsumer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 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 io.actor4j.core.function; 17 | 18 | import java.util.Objects; 19 | 20 | @FunctionalInterface 21 | public interface QuintConsumer { 22 | void accept(T t, U u, V v, W w, X x); 23 | 24 | default QuintConsumer andThen(QuintConsumer after) { 25 | Objects.requireNonNull(after); 26 | 27 | return (t, u, v, w, x) -> { 28 | accept(t, u, v, w, x); 29 | after.accept(t, u, v, w, x); 30 | }; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/function/SextConsumer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 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 io.actor4j.core.function; 17 | 18 | import java.util.Objects; 19 | 20 | @FunctionalInterface 21 | public interface SextConsumer { 22 | void accept(T t, U u, V v, W w, X x, Y y); 23 | 24 | default SextConsumer andThen(SextConsumer after) { 25 | Objects.requireNonNull(after); 26 | 27 | return (t, u, v, w, x, y) -> { 28 | accept(t, u, v, w, x, y); 29 | after.accept(t, u, v, w, x, y); 30 | }; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/function/TriConsumer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2021, David A. Bauer. All rights reserved. 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 io.actor4j.core.function; 17 | 18 | import java.util.Objects; 19 | 20 | @FunctionalInterface 21 | public interface TriConsumer { 22 | void accept(T t, U u, V v); 23 | 24 | default TriConsumer andThen(TriConsumer after) { 25 | Objects.requireNonNull(after); 26 | 27 | return (t, u, v) -> { 28 | accept(t, u, v); 29 | after.accept(t, u, v); 30 | }; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/function/TriFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2021, David A. Bauer. All rights reserved. 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 io.actor4j.core.function; 17 | 18 | import java.util.Objects; 19 | import java.util.function.Function; 20 | 21 | @FunctionalInterface 22 | public interface TriFunction { 23 | R apply(T t, U u, V v); 24 | 25 | default TriFunction andThen(Function after) { 26 | Objects.requireNonNull(after); 27 | return (T t, U u, V v) -> after.apply(apply(t, u, v)); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/id/ActorId.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2025, David A. Bauer. All rights reserved. 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 io.actor4j.core.id; 17 | 18 | import java.util.UUID; 19 | 20 | import io.actor4j.core.utils.Shareable; 21 | 22 | public interface ActorId extends Shareable { 23 | public ActorId localId(); 24 | public UUID globalId(); 25 | 26 | public static ActorId none() { 27 | return new ActorId() { 28 | @Override 29 | public ActorId localId() { 30 | return null; 31 | } 32 | 33 | @Override 34 | public UUID globalId() { 35 | return null; 36 | } 37 | 38 | }; 39 | } 40 | 41 | public static ActorId of(UUID globalId) { 42 | return GlobalId.of(globalId); 43 | } 44 | 45 | public static ActorId ofRedirect() { 46 | return RedirectId.of(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/id/GlobalId.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2025, David A. Bauer. All rights reserved. 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 io.actor4j.core.id; 17 | 18 | import java.util.UUID; 19 | 20 | public record GlobalId(ActorId localId, UUID globalId) implements ActorId { 21 | public static final UUID UUID_ZERO = UUID.fromString("00000000-0000-0000-0000-000000000000"); 22 | 23 | public GlobalId(UUID globalId) { 24 | this(null, globalId); 25 | } 26 | 27 | public static ActorId of(String globalId) { 28 | UUID uuid = UUID_ZERO; 29 | try { 30 | uuid = UUID.fromString(globalId); 31 | } 32 | catch (IllegalArgumentException e) { 33 | e.printStackTrace(); 34 | } 35 | 36 | return new GlobalId(uuid); 37 | } 38 | 39 | public static ActorId of(UUID globalId) { 40 | return new GlobalId(globalId); 41 | } 42 | 43 | public static ActorId random() { 44 | return new GlobalId(UUID.randomUUID()); 45 | } 46 | 47 | public static ActorId zero() { 48 | return new GlobalId(UUID_ZERO); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/id/RedirectId.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2025, David A. Bauer. All rights reserved. 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 io.actor4j.core.id; 17 | 18 | import java.util.UUID; 19 | 20 | public record RedirectId(ActorId localId, UUID globalId) implements ActorId { 21 | public RedirectId() { 22 | this(null, null); 23 | } 24 | 25 | 26 | public static ActorId of() { 27 | return new RedirectId(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/immutable/ImmutableCollection.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 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 io.actor4j.core.immutable; 17 | 18 | import io.actor4j.core.utils.Shareable; 19 | 20 | public interface ImmutableCollection extends Shareable { 21 | public C get(); 22 | } 23 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/immutable/ImmutableList.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2020, David A. Bauer. All rights reserved. 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 io.actor4j.core.immutable; 17 | 18 | import java.util.Collections; 19 | import java.util.List; 20 | 21 | public class ImmutableList implements ImmutableCollection> { 22 | protected final List list; 23 | 24 | public ImmutableList() { 25 | super(); 26 | 27 | this.list = Collections.emptyList(); 28 | } 29 | 30 | public ImmutableList(List list) { 31 | super(); 32 | 33 | this.list = Collections.unmodifiableList(list); 34 | } 35 | 36 | @Override 37 | public List get() { 38 | return list; 39 | } 40 | 41 | public static ImmutableList of() { 42 | return new ImmutableList<>(); 43 | } 44 | 45 | public static ImmutableList of(List list) { 46 | return new ImmutableList<>(list); 47 | } 48 | 49 | @Override 50 | public String toString() { 51 | return "ImmutableList [list=" + list + "]"; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/immutable/ImmutableMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2020, David A. Bauer. All rights reserved. 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 io.actor4j.core.immutable; 17 | 18 | import java.util.Collections; 19 | import java.util.Map; 20 | 21 | public class ImmutableMap implements ImmutableCollection> { 22 | protected final Map map; 23 | 24 | public ImmutableMap() { 25 | super(); 26 | 27 | this.map = Collections.emptyMap(); 28 | } 29 | 30 | public ImmutableMap(Map map) { 31 | super(); 32 | 33 | this.map = Collections.unmodifiableMap(map); 34 | } 35 | 36 | @Override 37 | public Map get() { 38 | return map; 39 | } 40 | 41 | public static ImmutableMap of() { 42 | return new ImmutableMap<>(); 43 | } 44 | 45 | public static ImmutableMap of(Map map) { 46 | return new ImmutableMap<>(map); 47 | } 48 | 49 | @Override 50 | public String toString() { 51 | return "ImmutableMap [map=" + map + "]"; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/immutable/ImmutableObject.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2018, David A. Bauer. All rights reserved. 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 io.actor4j.core.immutable; 17 | 18 | import io.actor4j.core.messages.ActorMessageUtils; 19 | import io.actor4j.core.utils.DeepCopyable; 20 | import io.actor4j.core.utils.Shareable; 21 | 22 | public class ImmutableObject implements ImmutableCollection { 23 | protected final T value; 24 | 25 | public ImmutableObject(T value) { 26 | super(); 27 | 28 | if (value!=null) 29 | if (!(ActorMessageUtils.isSupportedType(value.getClass()) || value instanceof Record || value instanceof Shareable || value instanceof DeepCopyable || value instanceof Exception)) 30 | throw new IllegalArgumentException(); 31 | 32 | this.value = value; 33 | } 34 | 35 | @Override 36 | public T get() { 37 | return value; 38 | } 39 | 40 | public static ImmutableObject of(T value) { 41 | return new ImmutableObject<>(value); 42 | } 43 | 44 | @Override 45 | public String toString() { 46 | return "ImmutableObject [value=" + value + "]"; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/immutable/ImmutableSet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2020, David A. Bauer. All rights reserved. 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 io.actor4j.core.immutable; 17 | 18 | import java.util.Collections; 19 | import java.util.Set; 20 | 21 | public class ImmutableSet implements ImmutableCollection> { 22 | protected final Set set; 23 | 24 | public ImmutableSet() { 25 | super(); 26 | 27 | this.set = Collections.emptySet(); 28 | } 29 | 30 | public ImmutableSet(Set set) { 31 | super(); 32 | 33 | this.set = Collections.unmodifiableSet(set); 34 | } 35 | 36 | @Override 37 | public Set get() { 38 | return set; 39 | } 40 | 41 | public static ImmutableSet of() { 42 | return new ImmutableSet<>(); 43 | } 44 | 45 | public static ImmutableSet of(Set set) { 46 | return new ImmutableSet<>(set); 47 | } 48 | 49 | @Override 50 | public String toString() { 51 | return "ImmutableSet [set=" + set + "]"; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/json/ObjectMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2024, David A. Bauer. All rights reserved. 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 io.actor4j.core.json; 17 | 18 | import io.actor4j.core.json.api.ObjectMapperService; 19 | import io.actor4j.core.runtime.service.loader.ServiceLoader; 20 | import io.actor4j.core.utils.GenericType; 21 | 22 | public interface ObjectMapper { 23 | public static ObjectMapper create() { 24 | ObjectMapperService service = ServiceLoader.findFirst(ObjectMapperService.class); 25 | 26 | return service!=null ? service.create() : null; 27 | } 28 | 29 | public String mapFrom(Object obj); 30 | public T mapTo(String json, Class type); 31 | public T mapTo(String json, GenericType type); 32 | } 33 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/json/api/JsonFactoryService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2024, David A. Bauer. All rights reserved. 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 io.actor4j.core.json.api; 17 | 18 | import java.util.List; 19 | 20 | import io.actor4j.core.json.JsonArray; 21 | import io.actor4j.core.json.JsonObject; 22 | 23 | public interface JsonFactoryService { 24 | public JsonObject createJsonObject(); 25 | public JsonObject createJsonObject(Object obj); 26 | public JsonObject createJsonObject(String json); 27 | 28 | public JsonArray createJsonArray(); 29 | public JsonArray createJsonArray(Object obj); 30 | public JsonArray createJsonArray(List list); 31 | public JsonArray createJsonArray(String json); 32 | } 33 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/json/api/ObjectMapperService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2024, David A. Bauer. All rights reserved. 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 io.actor4j.core.json.api; 17 | 18 | import io.actor4j.core.json.ObjectMapper; 19 | 20 | public interface ObjectMapperService { 21 | public ObjectMapper create(); 22 | } 23 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/persistence/ActorPersistenceDTO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2017, David A. Bauer. All rights reserved. 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 io.actor4j.core.persistence; 17 | 18 | import java.util.UUID; 19 | 20 | public record ActorPersistenceDTO( 21 | T value, 22 | UUID persistenceId, 23 | long timeStamp, 24 | int index /*only used, if it has the same timestamp as the last one*/) { 25 | } 26 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/persistence/drivers/PersistenceDriver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2018, David A. Bauer. All rights reserved. 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 io.actor4j.core.persistence.drivers; 17 | 18 | import io.actor4j.core.ActorSystem; 19 | 20 | public abstract class PersistenceDriver { 21 | protected final String host; 22 | protected final int port; 23 | protected final String databaseName; 24 | 25 | public PersistenceDriver(String host, int port, String databaseName) { 26 | this.host = host; 27 | this.port = port; 28 | this.databaseName = databaseName; 29 | } 30 | 31 | public String getHost() { 32 | return host; 33 | } 34 | 35 | public int getPort() { 36 | return port; 37 | } 38 | 39 | public String getDatabaseName() { 40 | return databaseName; 41 | } 42 | 43 | public abstract void open(); 44 | public abstract void close(); 45 | 46 | public abstract PersistenceImpl createPersistenceImpl(ActorSystem parent); 47 | } 48 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/persistence/drivers/PersistenceImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2018, David A. Bauer. All rights reserved. 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 io.actor4j.core.persistence.drivers; 17 | 18 | import io.actor4j.core.ActorSystem; 19 | import io.actor4j.core.id.ActorId; 20 | import io.actor4j.core.messages.ActorMessage; 21 | 22 | public abstract class PersistenceImpl { 23 | protected ActorSystem parent; 24 | protected ActorId id; 25 | 26 | protected PersistenceDriver driver; 27 | 28 | public PersistenceImpl(ActorSystem parent, PersistenceDriver driver) { 29 | this.parent = parent; 30 | this.driver = driver; 31 | } 32 | 33 | public ActorId self() { 34 | return id; 35 | } 36 | 37 | public void preStart(ActorId id) { 38 | this.id = id; 39 | } 40 | 41 | public abstract void receive(ActorMessage message); 42 | } 43 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/pods/ActorPod.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2020, David A. Bauer. All rights reserved. 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 io.actor4j.core.pods; 17 | 18 | import io.actor4j.core.ActorPodService; 19 | import io.actor4j.core.pods.actors.PodActor; 20 | 21 | public abstract class ActorPod implements Pod { 22 | public ActorPod() { 23 | super(); 24 | } 25 | 26 | public abstract PodActor create(); 27 | 28 | @Override 29 | public void register(ActorPodService service, PodContext context) { 30 | service.addPodActor(() -> create(), context); 31 | } 32 | } -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/pods/Pod.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2021, David A. Bauer. All rights reserved. 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 io.actor4j.core.pods; 17 | 18 | import io.actor4j.core.ActorPodService; 19 | 20 | public interface Pod { 21 | public void register(ActorPodService service, PodContext context); 22 | 23 | public String domain(); 24 | } 25 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/pods/PodContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 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 io.actor4j.core.pods; 17 | 18 | import java.util.function.Function; 19 | 20 | public record PodContext(String domain, boolean isShard, String shardId, boolean primaryReplica, 21 | Function function) { 22 | 23 | /** 24 | * Exists on this actor system a running primary replica of this pod? 25 | */ 26 | public boolean hasPrimaryReplica() { 27 | return function.apply(domain); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/pods/PodFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2020, David A. Bauer. All rights reserved. 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 io.actor4j.core.pods; 17 | 18 | import io.actor4j.core.runtime.di.FactoryInjector; 19 | 20 | public interface PodFactory extends FactoryInjector { 21 | } 22 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/pods/RemotePodMessage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.actor4j.core.pods; 18 | 19 | public record RemotePodMessage(RemotePodMessageDTO remotePodMessageDTO, String replyAddress, Object user, boolean isRequest) { 20 | public RemotePodMessage(RemotePodMessageDTO remotePodMessageDTO, String replyAddress, Object user) { 21 | this(remotePodMessageDTO, replyAddress, user, false); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/pods/RemotePodMessageDTO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.actor4j.core.pods; 18 | 19 | public record RemotePodMessageDTO(Object payload, int tag, String alias, Object params, Object auth, boolean reply) { 20 | 21 | public RemotePodMessageDTO(Object payload, int tag, String alias, Object params, boolean reply) { 22 | this(payload, tag, alias, params, null, reply); 23 | } 24 | 25 | public RemotePodMessageDTO(Object payload, int tag, String alias, boolean reply) { 26 | this(payload, tag, alias, null, null, reply); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/pods/Shard.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2020, David A. Bauer. All rights reserved. 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 io.actor4j.core.pods; 17 | 18 | import io.actor4j.core.messages.ActorMessage; 19 | 20 | public interface Shard { 21 | public String shardId(ActorMessage message, int totalShardCount); 22 | } 23 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/pods/SystemPod.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2020, David A. Bauer. All rights reserved. 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 io.actor4j.core.pods; 17 | 18 | public abstract class SystemPod implements Pod { 19 | public SystemPod() { 20 | super(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/pods/actors/DefaultPodActor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2020, David A. Bauer. All rights reserved. 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 io.actor4j.core.pods.actors; 17 | 18 | import io.actor4j.core.id.ActorId; 19 | 20 | public abstract class DefaultPodActor extends PodActor { 21 | protected final HandlerPodActorFactory handlerPodActorFactory; 22 | protected ActorId handlerPodActor; 23 | 24 | public DefaultPodActor(HandlerPodActorFactory handlerPodActorFactory) { 25 | super(); 26 | this.handlerPodActorFactory = handlerPodActorFactory; 27 | } 28 | 29 | @Override 30 | public void preStart() { 31 | handlerPodActor = addChild(() -> handlerPodActorFactory.create(groupId, getContext())); 32 | 33 | register(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/pods/actors/DefaultShardPodActor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2021, David A. Bauer. All rights reserved. 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 io.actor4j.core.pods.actors; 17 | 18 | import io.actor4j.core.id.ActorId; 19 | 20 | public abstract class DefaultShardPodActor extends PodActor { 21 | protected final ShardProxyPodActorFactory shardProxyPodActorFactory; 22 | protected final HandlerPodActorFactory handlerPodActorFactory; 23 | protected ActorId shardProxyPodActor; 24 | protected ActorId handlerPodActor; 25 | 26 | public DefaultShardPodActor(ShardProxyPodActorFactory shardProxyPodActorFactory, HandlerPodActorFactory handlerPodActorFactory) { 27 | super(); 28 | this.shardProxyPodActorFactory = shardProxyPodActorFactory; 29 | this.handlerPodActorFactory = handlerPodActorFactory; 30 | } 31 | 32 | @Override 33 | public void preStart() { 34 | if (getContext().isShard()) 35 | shardProxyPodActor = addChild(() -> shardProxyPodActorFactory.create(groupId, getContext())); 36 | handlerPodActor = addChild(() -> handlerPodActorFactory.create(groupId, getContext())); 37 | 38 | register(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/pods/actors/HandlerPodActorFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2020, David A. Bauer. All rights reserved. 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 io.actor4j.core.pods.actors; 17 | 18 | import java.util.UUID; 19 | 20 | import io.actor4j.core.pods.PodContext; 21 | 22 | public interface HandlerPodActorFactory { 23 | public HandlerPodActor create(UUID groupId, PodContext context); 24 | } -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/pods/actors/PodActor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 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 io.actor4j.core.pods.actors; 17 | 18 | import java.util.UUID; 19 | 20 | import io.actor4j.core.actors.Actor; 21 | import io.actor4j.core.actors.ActorGroupMember; 22 | import io.actor4j.core.pods.PodContext; 23 | import io.actor4j.core.runtime.InternalPodActorCell; 24 | 25 | public abstract class PodActor extends Actor implements ActorGroupMember { 26 | protected final UUID groupId; 27 | 28 | public PodActor() { 29 | super(); 30 | 31 | this.groupId = UUID.randomUUID(); 32 | } 33 | 34 | @Override 35 | public UUID getGroupId() { 36 | return groupId; 37 | } 38 | 39 | @Override 40 | public void preStart() { 41 | register(); 42 | } 43 | 44 | public PodContext getContext() { 45 | return ((InternalPodActorCell)cell).getContext(); 46 | } 47 | 48 | public abstract void register(); 49 | } 50 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/pods/actors/ShardProxyPodActorFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2020, David A. Bauer. All rights reserved. 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 io.actor4j.core.pods.actors; 17 | 18 | import java.util.UUID; 19 | 20 | import io.actor4j.core.pods.PodContext; 21 | 22 | public interface ShardProxyPodActorFactory { 23 | public ShardProxyPodActor create(UUID groupId, PodContext context); 24 | } -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/pods/api/Caching.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2023, David A. Bauer. All rights reserved. 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 io.actor4j.core.pods.api; 17 | 18 | public interface Caching { 19 | public T getCacheManager(); 20 | } 21 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/pods/api/Database.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2020, David A. Bauer. All rights reserved. 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 io.actor4j.core.pods.api; 17 | 18 | public interface Database { 19 | public T getClient(); 20 | } 21 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/pods/api/Host.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2024, David A. Bauer. All rights reserved. 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 io.actor4j.core.pods.api; 17 | 18 | public interface Host { 19 | public T getInstance(); 20 | } 21 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/pods/functions/PodFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2020, David A. Bauer. All rights reserved. 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 io.actor4j.core.pods.functions; 17 | 18 | import io.actor4j.core.actors.ActorRef; 19 | import io.actor4j.core.messages.ActorMessage; 20 | import io.actor4j.core.pods.PodContext; 21 | import io.actor4j.core.utils.Pair; 22 | 23 | public abstract class PodFunction { 24 | protected ActorRef host; 25 | protected PodContext context; 26 | 27 | public PodFunction(ActorRef host, PodContext context) { 28 | super(); 29 | this.host = host; 30 | this.context = context; 31 | } 32 | 33 | public abstract Pair handle(ActorMessage message); 34 | } 35 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/pods/functions/PodRemoteFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2020, David A. Bauer. All rights reserved. 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 io.actor4j.core.pods.functions; 17 | 18 | import java.util.UUID; 19 | 20 | import io.actor4j.core.actors.ActorRef; 21 | import io.actor4j.core.pods.PodContext; 22 | import io.actor4j.core.pods.RemotePodMessage; 23 | import io.actor4j.core.utils.Pair; 24 | 25 | public abstract class PodRemoteFunction extends PodFunction{ 26 | public PodRemoteFunction(ActorRef host, PodContext context) { 27 | super(host, context); 28 | } 29 | 30 | public abstract Pair handle(RemotePodMessage remoteMessage, UUID interaction); 31 | } 32 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/pods/utils/PodRequestParam.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 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 io.actor4j.core.pods.utils; 17 | 18 | public final class PodRequestParam { 19 | public static final String KEY = "key"; 20 | public static final String VALUE = "value"; 21 | 22 | public static final String ID = "id"; 23 | 24 | public static final int PARAM_1 = 1; 25 | public static final int PARAM_2 = 2; 26 | public static final int PARAM_3 = 3; 27 | public static final int PARAM_4 = 4; 28 | public static final int PARAM_5 = 5; 29 | public static final int PARAM_6 = 6; 30 | public static final int PARAM_7 = 7; 31 | public static final int PARAM_8 = 8; 32 | public static final int PARAM_9 = 9; 33 | public static final int PARAM_10 = 10; 34 | } -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/runtime/ActorExecutorService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime; 17 | 18 | import java.util.List; 19 | import java.util.Set; 20 | 21 | import io.actor4j.core.messages.ActorMessage; 22 | import io.actor4j.core.runtime.fault.tolerance.FaultToleranceManager; 23 | import io.actor4j.core.runtime.persistence.ActorPersistenceService; 24 | import io.actor4j.core.utils.ActorTimer; 25 | 26 | public interface ActorExecutorService { 27 | public FaultToleranceManager getFaultToleranceManager(); 28 | public ActorPersistenceService getPersistenceService(); 29 | 30 | public boolean isStarted(); 31 | 32 | public ActorTimer timer(); 33 | public ActorTimer globalTimer(); 34 | 35 | public void run(Runnable onStartup); 36 | public void start(Runnable onStartup, Runnable onTermination); 37 | public void shutdown(boolean await); 38 | 39 | public void resource(final ActorMessage message); 40 | 41 | public long getCount(); 42 | public List getCounts(); 43 | 44 | public Set nonResponsiveThreads(); 45 | public int nonResponsiveThreadsCount(); 46 | } 47 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/runtime/ActorGlobalSettings.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime; 17 | 18 | import java.util.UUID; 19 | 20 | import io.actor4j.core.function.SextConsumer; 21 | import io.actor4j.core.function.TriConsumer; 22 | import io.actor4j.core.id.ActorId; 23 | 24 | public class ActorGlobalSettings { 25 | // @See: RemoteHandlerPodActor, RemoteFunctionPod 26 | public static TriConsumer internal_server_callback; 27 | // @See: RemoteHandlerPodActor, RemoteFunctionPod 28 | public static SextConsumer internal_server_request; 29 | } 30 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/runtime/ActorStrategyOnFailure.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime; 17 | 18 | public interface ActorStrategyOnFailure { 19 | public void handle(InternalActorCell cell, Exception e); 20 | } 21 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/runtime/ActorSystemError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime; 17 | 18 | public enum ActorSystemError { 19 | ACTOR_INITIALIZATION, ACTOR, PSEUDO_ACTOR, RESOURCE_ACTOR, EMBEDDED_ACTOR, REPLICATION, WATCHDOG, EXECUTER_ACTOR, EXECUTER_RESOURCE, EXECUTER_CLIENT 20 | } 21 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/runtime/ActorThreadMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2017, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime; 17 | 18 | public enum ActorThreadMode { 19 | PARK, SLEEP, YIELD, HYBRID 20 | } 21 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/runtime/InternalPodActorCell.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime; 17 | 18 | import io.actor4j.core.pods.PodContext; 19 | 20 | public interface InternalPodActorCell extends InternalActorCell { 21 | public PodContext getContext(); 22 | public void setContext(PodContext context); 23 | } 24 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/runtime/PodReplicationControllerRunnableFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2020, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime; 17 | 18 | import java.util.function.Function; 19 | 20 | public interface PodReplicationControllerRunnableFactory extends Function{ 21 | } 22 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/runtime/PseudoActorCellFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime; 17 | 18 | import io.actor4j.core.actors.Actor; 19 | import io.actor4j.core.function.TriFunction; 20 | 21 | public interface PseudoActorCellFactory extends TriFunction { 22 | } 23 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/runtime/WatchdogRunnableFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2020, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime; 17 | 18 | import java.util.List; 19 | import java.util.function.BiFunction; 20 | 21 | import io.actor4j.core.id.ActorId; 22 | 23 | public interface WatchdogRunnableFactory extends BiFunction, WatchdogRunnable>{ 24 | } 25 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/runtime/di/DIContainer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2021, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime.di; 17 | 18 | public interface DIContainer { 19 | public void register(K key, FactoryInjector factoryInjector); 20 | public Object getInstance(K key) throws Exception; 21 | public void unregister(K key); 22 | } 23 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/runtime/di/FactoryInjector.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2021, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime.di; 17 | 18 | public interface FactoryInjector { 19 | public T create(); 20 | } 21 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/runtime/embedded/ActorEmbeddedRouter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2017, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime.embedded; 17 | 18 | import java.util.HashMap; 19 | import java.util.Map; 20 | 21 | public class ActorEmbeddedRouter extends HashMap { 22 | protected static final long serialVersionUID = 1L; 23 | 24 | public ActorEmbeddedRouter() { 25 | super(); 26 | } 27 | 28 | public ActorEmbeddedRouter(int initialCapacity, float loadFactor) { 29 | super(initialCapacity, loadFactor); 30 | } 31 | 32 | public ActorEmbeddedRouter(int initialCapacity) { 33 | super(initialCapacity); 34 | } 35 | 36 | public ActorEmbeddedRouter(Map m) { 37 | super(m); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/runtime/embedded/EmbeddedActorStrategyOnFailure.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime.embedded; 17 | 18 | public interface EmbeddedActorStrategyOnFailure { 19 | public void handle(InternalEmbeddedActorCell cell, Exception e); 20 | } 21 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/runtime/embedded/protocol/StopProtocol.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime.embedded.protocol; 17 | 18 | import static io.actor4j.core.logging.ActorLogger.INFO; 19 | import static io.actor4j.core.logging.ActorLogger.systemLogger; 20 | import static io.actor4j.core.utils.ActorUtils.actorLabel; 21 | 22 | import io.actor4j.core.actors.EmbeddedHostActor; 23 | import io.actor4j.core.runtime.embedded.InternalEmbeddedActorCell; 24 | 25 | public class StopProtocol { 26 | protected final InternalEmbeddedActorCell cell; 27 | 28 | public StopProtocol(InternalEmbeddedActorCell cell) { 29 | this.cell = cell; 30 | } 31 | 32 | public void postStop() { 33 | if (cell.host() instanceof EmbeddedHostActor h) 34 | h.removeEmbeddedChild(cell.getId()); 35 | systemLogger().log(INFO, String.format("[LIFECYCLE] embedded actor (%s) stopped", actorLabel(cell.getActor()))); 36 | } 37 | 38 | public void apply() { 39 | postStop(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/runtime/fault/tolerance/ErrorHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime.fault.tolerance; 17 | 18 | import io.actor4j.core.runtime.ActorSystemError; 19 | 20 | public interface ErrorHandler { 21 | public void handle(Throwable t, ActorSystemError systemError, String message, Object faultToleranceId); 22 | } 23 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/runtime/fault/tolerance/FaultToleranceManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime.fault.tolerance; 17 | 18 | import io.actor4j.core.runtime.ActorSystemError; 19 | 20 | //Adapted for actor4j 21 | public final class FaultToleranceManager { 22 | protected /*final*/ ErrorHandler errorHandler; //TODO: change to final, adapt test case 23 | 24 | public FaultToleranceManager(ErrorHandler errorHandler) { 25 | super(); 26 | this.errorHandler = errorHandler; 27 | } 28 | 29 | public ErrorHandler getErrorHandler() { 30 | return errorHandler; 31 | } 32 | 33 | public void setErrorHandler(ErrorHandler errorHandler) { 34 | this.errorHandler = errorHandler; 35 | } 36 | 37 | public void notifyErrorHandler(Throwable t, ActorSystemError systemError, Object faultToleranceId) { 38 | notifyErrorHandler(t, systemError, "", faultToleranceId); 39 | } 40 | 41 | public synchronized void notifyErrorHandler(Throwable t, ActorSystemError systemError, String message, Object faultToleranceId) { 42 | if (errorHandler!=null) 43 | errorHandler.handle(t, systemError, message, faultToleranceId); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/runtime/fault/tolerance/FaultToleranceMethod.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime.fault.tolerance; 17 | 18 | public interface FaultToleranceMethod { 19 | public void run(Object faultToleranceId); 20 | public void error(Throwable t); 21 | public void postRun(); 22 | } 23 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/runtime/persistence/ActorPersistenceService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime.persistence; 17 | 18 | import java.util.List; 19 | 20 | import io.actor4j.core.ActorService; 21 | import io.actor4j.core.id.ActorId; 22 | 23 | public interface ActorPersistenceService { 24 | public ActorService getService(); 25 | public List persistenceActorIds(); 26 | 27 | public void start(); 28 | public void shutdown(); 29 | } 30 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/runtime/persistence/actor/PersistenceServiceActor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2018, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime.persistence.actor; 17 | 18 | import io.actor4j.core.actors.Actor; 19 | import io.actor4j.core.messages.ActorMessage; 20 | import io.actor4j.core.persistence.drivers.PersistenceImpl; 21 | 22 | public class PersistenceServiceActor extends Actor { 23 | protected final PersistenceImpl impl; 24 | 25 | public static final int PERSIST_EVENTS = 100; 26 | public static final int PERSIST_STATE = 101; 27 | public static final int RECOVER = 102; 28 | 29 | public PersistenceServiceActor(String name, PersistenceImpl impl) { 30 | super(name); 31 | this.impl = impl; 32 | } 33 | 34 | @Override 35 | public void preStart() { 36 | impl.preStart(self()); 37 | } 38 | 39 | @Override 40 | public void receive(ActorMessage message) { 41 | impl.receive(message); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/runtime/pods/PodReplicationController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime.pods; 17 | 18 | import java.io.File; 19 | import java.util.Map; 20 | 21 | import io.actor4j.core.pods.PodConfiguration; 22 | import io.actor4j.core.pods.PodFactory; 23 | 24 | public interface PodReplicationController { 25 | public Map getPodReplicationMap(); 26 | 27 | public void deployPods(File jarFile, PodConfiguration podConfiguration); 28 | public void deployPods(PodFactory factory, PodConfiguration podConfiguration); 29 | 30 | public void undeployPod(String domain, String shardId, int instances); 31 | public void undeployPods(String domain); 32 | 33 | public void updatePods(File jarFile, PodConfiguration podConfiguration); 34 | public void updatePods(String domain, PodFactory factory, PodConfiguration podConfiguration); 35 | 36 | public void increasePods(String domain, String shardId); 37 | public void increasePods(String domain, String shardId, int instances); 38 | 39 | public void decreasePods(String domain, String shardId); 40 | public void decreasePods(String domain, String shardId, int instances); 41 | } 42 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/runtime/pods/PodReplicationTuple.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime.pods; 17 | 18 | import io.actor4j.core.pods.PodConfiguration; 19 | 20 | public record PodReplicationTuple(PodConfiguration podConfiguration, PodSystemConfiguration podSystemConfiguration, 21 | String jarFileName) { 22 | 23 | public PodReplicationTuple(PodConfiguration podConfiguration, PodSystemConfiguration podSystemConfiguration) { 24 | this(podConfiguration, podSystemConfiguration, null); 25 | } 26 | 27 | public boolean hasJarFile() { 28 | return jarFileName!=null; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/runtime/pods/PodSystemConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime.pods; 17 | 18 | import java.util.List; 19 | 20 | public record PodSystemConfiguration(List primaryShardIds, List secondaryShardIds, 21 | List secondaryShardCounts, int currentShardCount, int currentReplicaCount) { 22 | } 23 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/runtime/protocols/ActorProtocolTag.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2017, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime.protocols; 17 | 18 | public final class ActorProtocolTag { 19 | public static final int INTERNAL_RESTART = -1; 20 | public static final int INTERNAL_STOP = -2; 21 | public static final int INTERNAL_STOP_SUCCESS = -3; 22 | public static final int INTERNAL_KILL = -4; 23 | public static final int INTERNAL_HEALTH_CHECK = -5; 24 | public static final int INTERNAL_RECOVER = -6; 25 | 26 | public static final int INTERNAL_PERSISTENCE_RECOVER = -7; 27 | public static final int INTERNAL_PERSISTENCE_SUCCESS = -8; 28 | public static final int INTERNAL_PERSISTENCE_FAILURE = -9; 29 | 30 | public static final int INTERNAL_ACTIVATE = -10; 31 | public static final int INTERNAL_DEACTIVATE = -11; 32 | 33 | public static final int INTERNAL_STOP_USER_SPACE = -12; 34 | public static final int INTERNAL_STOP_USER_SPACE_SUCCESS = -13; 35 | } 36 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/runtime/service/loader/ServiceLoader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2024, David A. Bauer. All rights reserved. 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 io.actor4j.core.runtime.service.loader; 17 | 18 | import java.util.Map; 19 | import java.util.Optional; 20 | import java.util.concurrent.ConcurrentHashMap; 21 | 22 | public final class ServiceLoader { 23 | private static final Map services = new ConcurrentHashMap<>(); 24 | private static final Object lock = new Object(); 25 | 26 | @SuppressWarnings("unchecked") 27 | public static S findFirst(Class service) { 28 | Object result = services.get(service.getName()); 29 | 30 | if (result==null) 31 | synchronized(lock) { 32 | if ((result=services.get(service.getName()))==null) { 33 | Optional optional = java.util.ServiceLoader.load(service)/*.stream().map(java.util.ServiceLoader.Provider::get)*/.findFirst(); 34 | if (optional.isPresent()) { 35 | result = optional.get(); 36 | services.put(service.getName(), result); 37 | } 38 | } 39 | } 40 | 41 | return result!=null ? (S)result : null; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/serializer/api/SerializerService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2024, David A. Bauer. All rights reserved. 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 io.actor4j.core.serializer.api; 17 | 18 | import io.actor4j.core.utils.GenericType; 19 | 20 | public interface SerializerService { 21 | public byte[] encode(Object value); 22 | 23 | public T decode(byte[] src); 24 | public T decode(byte[] src, Class type); 25 | public T decode(byte[] src, GenericType type); 26 | } 27 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/service/support/PodSupportService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2024, David A. Bauer. All rights reserved. 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 io.actor4j.core.service.support; 17 | 18 | import io.actor4j.core.actors.ActorRef; 19 | import io.actor4j.core.messages.ActorMessage; 20 | import io.actor4j.core.pods.PodContext; 21 | 22 | public interface PodSupportService { 23 | boolean handleMessage(ActorMessage message, ActorRef actorRef, PodContext context); 24 | } 25 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/service/support/SupportService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2024, David A. Bauer. All rights reserved. 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 io.actor4j.core.service.support; 17 | 18 | import io.actor4j.core.actors.ActorRef; 19 | import io.actor4j.core.messages.ActorMessage; 20 | 21 | public interface SupportService { 22 | boolean handleMessage(ActorMessage message, ActorRef actorRef); 23 | } 24 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/supervisor/DefaultSupervisorStrategy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2017, David A. Bauer. All rights reserved. 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 io.actor4j.core.supervisor; 17 | 18 | import static io.actor4j.core.supervisor.SupervisorStrategyDirective.*; 19 | 20 | import io.actor4j.core.exceptions.ActorInitializationException; 21 | import io.actor4j.core.exceptions.ActorKilledException; 22 | 23 | public class DefaultSupervisorStrategy extends OneForOneSupervisorStrategy { 24 | public DefaultSupervisorStrategy(int maxRetries, long withinTimeRange) { 25 | // super(-1, Integer.MAX_VALUE); // old default behaviour 26 | super(maxRetries, withinTimeRange); 27 | } 28 | 29 | @Override 30 | public SupervisorStrategyDirective apply(Exception e) { 31 | if (e instanceof ActorInitializationException || e instanceof ActorKilledException) 32 | return STOP; 33 | else 34 | return RESTART; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/supervisor/OneForAllSupervisorStrategy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2017, David A. Bauer. All rights reserved. 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 io.actor4j.core.supervisor; 17 | 18 | public abstract class OneForAllSupervisorStrategy extends SupervisorStrategy { 19 | public OneForAllSupervisorStrategy(int maxRetries, long withinTimeRange) { 20 | super(maxRetries, withinTimeRange); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/supervisor/OneForOneSupervisorStrategy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2017, David A. Bauer. All rights reserved. 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 io.actor4j.core.supervisor; 17 | 18 | public abstract class OneForOneSupervisorStrategy extends SupervisorStrategy { 19 | public OneForOneSupervisorStrategy(int maxRetries, long withinTimeRange) { 20 | super(maxRetries, withinTimeRange); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/supervisor/SupervisorStrategyDirective.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2017, David A. Bauer. All rights reserved. 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 io.actor4j.core.supervisor; 17 | 18 | public enum SupervisorStrategyDirective { 19 | RESUME, RESTART, STOP, ESCALATE 20 | } 21 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/utils/ActorFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2017, David A. Bauer. All rights reserved. 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 io.actor4j.core.utils; 17 | 18 | import io.actor4j.core.actors.Actor; 19 | import io.actor4j.core.runtime.di.FactoryInjector; 20 | 21 | public interface ActorFactory extends FactoryInjector { 22 | } 23 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/utils/ActorGroup.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2017, David A. Bauer. All rights reserved. 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 io.actor4j.core.utils; 17 | 18 | import java.util.Collection; 19 | import java.util.UUID; 20 | 21 | import io.actor4j.core.id.ActorId; 22 | 23 | public interface ActorGroup extends Collection { 24 | public UUID getId(); 25 | } 26 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/utils/ActorGroupList.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2017, David A. Bauer. All rights reserved. 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 io.actor4j.core.utils; 17 | 18 | import java.util.Collection; 19 | import java.util.LinkedList; 20 | import java.util.UUID; 21 | 22 | import io.actor4j.core.id.ActorId; 23 | 24 | public class ActorGroupList extends LinkedList implements ActorGroup { 25 | protected static final long serialVersionUID = 8641920411195875484L; 26 | 27 | protected final UUID id; 28 | 29 | public ActorGroupList() { 30 | super(); 31 | 32 | id = UUID.randomUUID(); 33 | } 34 | 35 | public ActorGroupList(Collection c) { 36 | super(c); 37 | 38 | id = UUID.randomUUID(); 39 | } 40 | 41 | @Override 42 | public UUID getId() { 43 | return id; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/utils/ActorGroupSet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2017, David A. Bauer. All rights reserved. 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 io.actor4j.core.utils; 17 | 18 | import java.util.Collection; 19 | import java.util.HashSet; 20 | import java.util.UUID; 21 | 22 | import io.actor4j.core.id.ActorId; 23 | 24 | public class ActorGroupSet extends HashSet implements ActorGroup { 25 | protected static final long serialVersionUID = 1L; 26 | 27 | protected final UUID id; 28 | 29 | public ActorGroupSet() { 30 | super(); 31 | 32 | id = UUID.randomUUID(); 33 | } 34 | 35 | public ActorGroupSet(Collection c) { 36 | super(c); 37 | 38 | id = UUID.randomUUID(); 39 | } 40 | 41 | public ActorGroupSet(int initialCapacity, float loadFactor) { 42 | super(initialCapacity, loadFactor); 43 | 44 | id = UUID.randomUUID(); 45 | } 46 | 47 | public ActorGroupSet(int initialCapacity) { 48 | super(initialCapacity); 49 | 50 | id = UUID.randomUUID(); 51 | } 52 | 53 | @Override 54 | public UUID getId() { 55 | return id; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/utils/ActorUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2020, David A. Bauer. All rights reserved. 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 io.actor4j.core.utils; 17 | 18 | import io.actor4j.core.actors.ActorRef; 19 | import io.actor4j.core.actors.EmbeddedActorRef; 20 | import io.actor4j.core.messages.ActorMessage; 21 | 22 | public final class ActorUtils { 23 | public static String actorLabel(ActorRef actorRef) { 24 | if (actorRef!=null) 25 | return actorRef.getName()!=null ? actorRef.getName() : actorRef.getId().toString(); 26 | else 27 | return null; 28 | } 29 | 30 | public static String actorLabel(EmbeddedActorRef actorRef) { 31 | return actorRef.getName()!=null ? actorRef.getName() : actorRef.getId().toString(); 32 | } 33 | 34 | public static boolean isDirective(ActorMessage message) { 35 | return message.tag()<0; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/utils/Cache.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2017, David A. Bauer. All rights reserved. 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 io.actor4j.core.utils; 17 | 18 | import java.util.List; 19 | import java.util.Map; 20 | 21 | public interface Cache extends ReadOnlyCache { 22 | public boolean containsKey(K key); 23 | 24 | public V get(K key); 25 | public Map get(List keys); 26 | 27 | public V put(K key, V value); 28 | public void put(Map entries); 29 | 30 | public boolean compareAndSet(K key, V expectedValue, V newValue); 31 | 32 | public void remove(K key); 33 | public void remove(List keys); 34 | 35 | public void clear(); 36 | 37 | public void evict(long duration); 38 | 39 | public void close(); 40 | } 41 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/utils/ConcurrentActorGroupQueue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2017, David A. Bauer. All rights reserved. 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 io.actor4j.core.utils; 17 | 18 | import java.util.Collection; 19 | import java.util.UUID; 20 | import java.util.concurrent.ConcurrentLinkedQueue; 21 | 22 | import io.actor4j.core.id.ActorId; 23 | 24 | public class ConcurrentActorGroupQueue extends ConcurrentLinkedQueue implements ActorGroup { 25 | protected static final long serialVersionUID = 1L; 26 | 27 | protected final UUID id; 28 | 29 | public ConcurrentActorGroupQueue() { 30 | super(); 31 | 32 | id = UUID.randomUUID(); 33 | } 34 | 35 | public ConcurrentActorGroupQueue(Collection c) { 36 | super(c); 37 | 38 | id = UUID.randomUUID(); 39 | } 40 | 41 | @Override 42 | public UUID getId() { 43 | return id; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/utils/EmbeddedActorFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 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 io.actor4j.core.utils; 17 | 18 | import io.actor4j.core.actors.EmbeddedActor; 19 | import io.actor4j.core.runtime.di.FactoryInjector; 20 | 21 | public interface EmbeddedActorFactory extends FactoryInjector { 22 | } 23 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/utils/GenericType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2024, David A. Bauer. All rights reserved. 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 io.actor4j.core.utils; 17 | 18 | import java.lang.reflect.ParameterizedType; 19 | import java.lang.reflect.Type; 20 | 21 | public abstract class GenericType { 22 | protected final Type type; 23 | 24 | protected GenericType() { 25 | super(); 26 | 27 | type = ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0]; 28 | } 29 | 30 | public Type getType() { 31 | return type; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/utils/Pair.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2024, David A. Bauer. All rights reserved. 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 io.actor4j.core.utils; 17 | 18 | public record Pair(A a, B b) { 19 | public static Pair of(A a, B b) { 20 | return new Pair(a, b); 21 | } 22 | 23 | public A left() { 24 | return a; 25 | } 26 | 27 | public B right() { 28 | return b; 29 | } 30 | 31 | public A key() { 32 | return a; 33 | } 34 | 35 | public B value() { 36 | return b; 37 | } 38 | 39 | public B entity() { 40 | return b; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/utils/PodActorFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2020, David A. Bauer. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.actor4j.core.utils; 18 | 19 | import io.actor4j.core.pods.actors.PodActor; 20 | import io.actor4j.core.runtime.di.FactoryInjector; 21 | 22 | public interface PodActorFactory extends FactoryInjector { 23 | } 24 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/utils/Range.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022, David A. Bauer. All rights reserved. 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 io.actor4j.core.utils; 17 | 18 | public record Range(int low, int high) { 19 | } 20 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/utils/ReadOnlyCache.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2024, David A. Bauer. All rights reserved. 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 io.actor4j.core.utils; 17 | 18 | import java.util.List; 19 | import java.util.Map; 20 | 21 | public interface ReadOnlyCache { 22 | public boolean containsKey(K key); 23 | 24 | public V get(K key); 25 | public Map get(List keys); 26 | } 27 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/utils/Shareable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2017, David A. Bauer. All rights reserved. 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 io.actor4j.core.utils; 17 | 18 | public interface Shareable { 19 | } 20 | -------------------------------------------------------------------------------- /actor4j-core-sdk/src/main/java/io/actor4j/core/utils/Triple.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2024, David A. Bauer. All rights reserved. 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 io.actor4j.core.utils; 17 | 18 | public record Triple(A a, B b, C c) { 19 | public static Triple of(A a, B b, C c) { 20 | return new Triple(a, b, c); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /doc/actor4j.asta: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/relvaner/actor4j-core/ee22ab1100eb1aebe64701a902df96b1dd7f2944/doc/actor4j.asta -------------------------------------------------------------------------------- /doc/actor4j.yuml.me: -------------------------------------------------------------------------------- 1 | [ActorSystem{bg:yellow}]<>->[ActorSystemImpl{bg:yellow}] 2 | [ActorSystem]^-[ActorService{bg:yellow}],[ActorSystem]^-[ActorVerificator{bg:yellow}],[ActorSystem]^-[TestSystem{bg:yellow}],[ActorSystem]^-[ActorAnalyzer{bg:yellow}] 3 | [ActorSystemImpl]->[ActorStrategyOnFailure] 4 | [ActorStrategyOnFailure]uses-.->[SupervisorStrategy{bg:royalblue}] 5 | [SupervisorStrategy]^-[OneForAllSupervisorStrategy{bg:royalblue}],[SupervisorStrategy]^-[OneForOneSupervisorStrategy{bg:royalblue}] 6 | [ActorSystemImpl]++->[ActorCell],[ActorSystemImpl]++->[ActorExecutorService{bg:tomato}],[ActorSystemImpl]++->[ActorMessageDispatcher{bg:palevioletred}] 7 | [ActorMessageDispatcher]uses-.->[ActorBalancingOnRuntime{bg:palevioletred}],[ActorMessageDispatcher]uses-.->[ActorBalancingOnCreation{bg:palevioletred}] 8 | [ActorBalancingOnRuntime]uses-.->[ActorGroupMember],[ActorBalancingOnCreation]uses-.->[ActorGroupMember] 9 | [ActorExecutorService]++->[ActorTimer{bg:tomato}],[ActorExecutorService]++->[ActorThread{bg:tomato}] 10 | [ActorThread]uses-.->[ActorStrategyOnFailure{bg:tomato}] 11 | [ActorCell{bg:violet}]uses-.->[ActorMessageDispatcher] 12 | [ActorCell]->[StopProtocol{bg:deepskyblue}],[ActorCell]->[RecoverProtocol{bg:deepskyblue}],[ActorCell]->[RestartProtocol{bg:deepskyblue}] 13 | [ActorCell]++->[Actor] 14 | [Actor{bg:springgreen}]^-[ResourceActor{bg:springgreen}],[Actor]^-[PersistentActor{bg:springgreen}],[Actor]^-[ActorWithRxStash{bg:springgreen}],[Actor]^-[ActorWithCache{bg:springgreen}],[Actor]^-[ActorWithGroup],[ActorWithGroup{bg:springgreen}]-.-^[ActorGroupMember{bg:springgreen}],[EmbeddedActor{bg:springgreen}]-.-^[Actor{bg:springgreen}] 15 | [ActorCell]^-[PseudoActorCell{bg:violet}],[PseudoActorCell]++->[PseudoActor{bg:chartreuse}] -------------------------------------------------------------------------------- /doc/images/analyzer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/relvaner/actor4j-core/ee22ab1100eb1aebe64701a902df96b1dd7f2944/doc/images/analyzer.png -------------------------------------------------------------------------------- /doc/images/cd_left_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/relvaner/actor4j-core/ee22ab1100eb1aebe64701a902df96b1dd7f2944/doc/images/cd_left_right.png -------------------------------------------------------------------------------- /doc/images/cd_top_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/relvaner/actor4j-core/ee22ab1100eb1aebe64701a902df96b1dd7f2944/doc/images/cd_top_down.png -------------------------------------------------------------------------------- /doc/images/class diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/relvaner/actor4j-core/ee22ab1100eb1aebe64701a902df96b1dd7f2944/doc/images/class diagram.png -------------------------------------------------------------------------------- /doc/images/lifecycle1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/relvaner/actor4j-core/ee22ab1100eb1aebe64701a902df96b1dd7f2944/doc/images/lifecycle1.png -------------------------------------------------------------------------------- /doc/images/lifecycle1_v2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/relvaner/actor4j-core/ee22ab1100eb1aebe64701a902df96b1dd7f2944/doc/images/lifecycle1_v2.png -------------------------------------------------------------------------------- /doc/images/lifecycle2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/relvaner/actor4j-core/ee22ab1100eb1aebe64701a902df96b1dd7f2944/doc/images/lifecycle2.png -------------------------------------------------------------------------------- /doc/images/promo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/relvaner/actor4j-core/ee22ab1100eb1aebe64701a902df96b1dd7f2944/doc/images/promo.png -------------------------------------------------------------------------------- /doc/images/rest api.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/relvaner/actor4j-core/ee22ab1100eb1aebe64701a902df96b1dd7f2944/doc/images/rest api.png -------------------------------------------------------------------------------- /doc/images/supervision.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/relvaner/actor4j-core/ee22ab1100eb1aebe64701a902df96b1dd7f2944/doc/images/supervision.png --------------------------------------------------------------------------------