Example usage for org.springframework.integration.gemfire.fork ForkUtil createControlFile

List of usage examples for org.springframework.integration.gemfire.fork ForkUtil createControlFile

Introduction

In this page you can find the example usage for org.springframework.integration.gemfire.fork ForkUtil createControlFile.

Prototype

public static boolean createControlFile(String name) throws IOException 

Source Link

Usage

From source file:org.springframework.integration.gemfire.fork.CacheServerProcess.java

public static void main(String[] args) throws Exception {

    Properties props = new Properties();
    props.setProperty("name", "CacheServer at " + new Date());
    props.setProperty("log-level", "info");

    logger.info("Connecting to the distributed system and creating the cache.");

    Cache cache = new CacheFactory(props).create();

    // Create region.
    Region<?, ?> region = cache.createRegionFactory(RegionShortcut.REPLICATE).setScope(Scope.DISTRIBUTED_ACK)
            .create("test");

    logger.info("Test region, " + region.getFullPath() + ", created in cache.");

    // Start Cache Server.
    CacheServer server = cache.addCacheServer();
    server.setPort(40404);//from   w  w  w.j ava 2 s .com
    logger.info("Starting server");
    server.start();
    ForkUtil.createControlFile(CacheServerProcess.class.getName());
    logger.info("Waiting for shutdown");

    BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
    bufferedReader.readLine();
}