Summary: Allows you to run a Processing Unit in standalone mode, meaning that the Processing Unit is run under its own constructed classloader, based on the Processing Unit structure.
OverviewThe standalone Processing Unit container allows you to run a Processing Unit (using the Processing Unit structure) in standalone mode. Standalone mode means that the Processing Unit is run under its own constructed classloader, based on the structure of the Processing Unit. The standalone Processing Unit container is built around the Spring ApplicationContext with several extensions, such as ClusterInfo and bean-level properties. The standalone Processing Unit container is run using the main() method, and is created using a ProcessingUnitContainerProvider. StandaloneProcessingUnitContainerProviderHere is an example of using a ProcessingUnitContainerProvider in order to create one: StandaloneProcessingUnitContainerProvider provider = new StandaloneProcessingUnitContainerProvider("data-processor"); // provide cluster information for the specific PU instance ClusterInfo clusterInfo = new ClusterInfo(); clusterInfo.setSchema("partitioned"); clusterInfo.setNumberOfInstances(2); clusterInfo.setInstnaceId(1); provider.setClusterInfo(clusterInfo); // set the config location (override the default one - classpath:/META-INF/spring/pu.xml) provider.addConfigLocation("classpath:/test/my-pu.xml"); // Build the Spring application context and "start" it StandaloneProcessingUnitContainer container = provider.createContainer(); // ... container.close(); The StandaloneProcessingUnitContainerProvider is constructed with a file-system path to the Processing Unit directory. It uses the processing unit structure in order to construct a new classloader and add to it the jar and class files, based on the structure. Executable StandaloneProcessingUnitContainerThe StandaloneProcessingUnitContainer provides an executable main() method that allows it to be run directly. The main() method uses the StandaloneProcessingUnitContainerProvider and command-line conventions in order to create the StandaloneProcessingUnitContainer. A required parameter is the Processing Unit location, pointing to the file-system location of the Processing Unit directory. The following is a list of all the possible command-line parameters available:
puInstanceOpenSpaces comes with the puInstance script, which uses the StandaloneProcessingUnitContainer in order to run a Processing Unit. Here are some examples of using the puInstance script in order to run a processing unit:
Unix
puInstance.sh -cluster schema=partitioned total_members=2 id=1 data-processor Windows puInstance.bat -cluster schema=partitioned total_members=2 id=1 data-processor The above example starts a Processing Unit (which includes an embedded Space) in a partitioned cluster schema, with two members and id=1. In order to run the full cluster, another puInstance has to be started with id=2.
Unix
puInstance.sh -cluster schema=primary_backup total_members=1,1 id=1 backup_id=1 -properties context.properties data-processor Windows puInstance.bat -cluster schema=primary_backup total_members=1,1 id=1 backup_id=1 -properties context.properties data-processor The above example starts a Processing Unit instance (with an embedded space) in a primary-backup cluster schema, with one primary and one backup. It also uses context-level properties that can be used by all the beans within the application context. |
![]() |
GigaSpaces.com - Legal Notice - 3rd Party Licenses - Site Map - API Docs - Forum - Downloads - Blog - White Papers - Contact Tech Writing - Gen. by Atlassian Confluence |