Exemple #1
0
        public static void Main(string[] args)
        {
            HostName       = Dns.GetHostName();
            CurrentProcess = Process.GetCurrentProcess();
            if (args.Length < 1)
            {
                url          = "jini://*/*/AIGDemo?locators=RajivPC&groups=Rajiv";
                NumberOfJobs = 200;
                NumberOfTask = 5;
            }
            else
            {
                url          = args[0];
                NumberOfJobs = args.Length == 1 ? 1000 : Convert.ToInt32(args[1]);
                NumberOfTask = args.Length == 2 ? 10 : Convert.ToInt32(args[2]);
            }
            Console.WriteLine("*** Connecting to remote space named '" + url + "' From Master...");
            SpaceProxy = GigaSpacesFactory.FindSpace(url);

            MasterHeartbeat masterHeartbeat = new MasterHeartbeat(Timeout);
            Thread          workerThread    = new Thread(masterHeartbeat.DoWork);

            workerThread.Start();
            new Master();
        }
Exemple #2
0
    public void creatVersionedSpace()
    {
        // Embedded Space
        String url = "/./xapTutorialSpace";

        // Create the SpaceProxy
        ISpaceProxy spaceProxy = GigaSpacesFactory.FindSpace(url);

        spaceProxy.OptimisticLocking = true;
    }
Exemple #3
0
    public void registerProductType()
    {
        if (proxy == null)
        {
            proxy = GigaSpacesFactory.FindSpace("/./xapTutorialSpace");

            service      = new CRUDService(proxy);
            spaceUtility = new SpaceUtility(proxy);
            userUtil     = new UserUtil(proxy);
        }
    }
Exemple #4
0
        private static void Main(string[] args)
        {
            Console.WriteLine("GigaSpaces Data Modeling Example");
            Console.WriteLine("--------------------------------");
            Console.WriteLine("1. Embedded one-to-one.");
            Console.WriteLine("2. Embedded one-to-many.");
            Console.WriteLine("3. Non-Embedded one-to-one.");
            Console.WriteLine("4. Non-Embedded one-to-many.");

            Console.WriteLine();
            Console.WriteLine("Please enter your selection:");
            var selection = Console.ReadLine();

            IExamplePattern pattern;

            switch (selection)
            {
            case "1":
                pattern = new EmbeddedOne2OneExample();
                break;

            case "2":
                pattern = new EmbeddedOne2ManyExample();
                break;

            case "3":
                pattern = new NonEmbeddedOne2OneExample();
                break;

            case "4":
                pattern = new NonEmbeddedOne2ManyExample();
                break;

            default:
                throw new InvalidOperationException("Select an option within range.");
            }

            Console.WriteLine();
            Console.WriteLine("Launching space, please wait.");
            ISpaceProxy proxy = GigaSpacesFactory.FindSpace("/./modeling-data-samples");

            Console.WriteLine("--------------------------------------------------------------------------------");
            Console.WriteLine("BEGIN EXAMPLE");
            Console.WriteLine("--------------------------------------------------------------------------------");
            Console.WriteLine();

            pattern.Fill(proxy);
            pattern.QuerySpace(proxy);

            Console.WriteLine();
            Console.WriteLine("Press any key to continue...");

            Console.ReadKey();
        }
        public static void Main(string[] args)
        {
            HostName       = Dns.GetHostName();
            CurrentProcess = Process.GetCurrentProcess();
            String url = args[0];

            Console.WriteLine("*** Connecting to remote space named '" + url + "' from Worker...");
            SpaceProxy = GigaSpacesFactory.FindSpace(url);

            WorkerHeartbeat masterHeartbeat = new WorkerHeartbeat(Timeout);
            Thread          workerThread    = new Thread(masterHeartbeat.DoWork);

            workerThread.Start();
            new Worker(args);
        }
    public void registerProductType()
    {
        if (proxy == null)
        {
            // Instatiate the embedded space
            proxy = GigaSpacesFactory.FindSpace("/./xapTutorialSpace");;

            spaceUtility = new SpaceUtility(proxy);
            userUtil     = new UserUtil(proxy);
            queryService = new QueryService(proxy);
            service      = new CRUDService(proxy);

            // Register the Space Document
        }

        // Create a user
        userUtil.loadUsers();

        service.registerProductType();
        service.createDocumemt();
    }
        public static void Main(string[] args)
        {
            url = args[0];
            Int32 batchSize = 10000;

            numOfTrades = Convert.ToInt32(args[1]);
            Console.WriteLine("Connecting to Space:" + url);
            SpaceProxy = GigaSpacesFactory.FindSpace(url);
            Console.WriteLine("Inserting " + numOfTrades + " Trades in the space");
            Int32 k = 0;

            Trade[] trades;
            if (numOfTrades <= batchSize)
            {
                trades = new Trade[numOfTrades];
                for (int i = 0; i < numOfTrades; i++)
                {
                    trades[i] = CalculateUtil.generateTrade(i + 1);
                }
                SpaceProxy.WriteMultiple(trades);
            }
            else
            {
                for (int i = 0; i < numOfTrades / batchSize; i++)
                {
                    trades = new Trade[batchSize];
                    for (int j = 0; j < batchSize; j++)
                    {
                        trades[j] = CalculateUtil.generateTrade(k + 1);
                        k++;
                    }
                    SpaceProxy.WriteMultiple(trades);
                }
            }
            Console.WriteLine("Press any key to continue...");
            Console.ReadKey();
        }
 public void init()
 {
     proxy = GigaSpacesFactory.FindSpace(url);
 }