org.objectfabric.DistributedClient Maven / Gradle / Ivy
/**
* This file is part of ObjectFabric (http://objectfabric.org).
*
* ObjectFabric is licensed under the Apache License, Version 2.0, the terms
* of which may be found at http://www.apache.org/licenses/LICENSE-2.0.html.
*
* Copyright ObjectFabric Inc.
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
* WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
package org.objectfabric;
import java.util.concurrent.atomic.AtomicInteger;
import org.junit.Assert;
import org.objectfabric.generated.Limit32;
import org.objectfabric.generated.LimitsObjectModel;
public class DistributedClient {
public static final int GO = 1, DONE = 2, CLOSING = 3, CLOSED = 4;
public static final int LIMIT = 10;
private static Limit32 _object;
private static AtomicInteger _progress;
private static int _flags;
private static volatile boolean _callback;
private static int[] _last = new int[Limit32.FIELD_COUNT];
public static void main(AtomicInteger progress, final int clients, int client, int flags) {
if (Debug.ENABLED)
Helper.instance().ProcessName = "Client " + client;
JVMPlatform.loadClass();
_progress = progress;
_flags = flags;
LimitsObjectModel.register();
final Workspace workspace = Distributed.createClientWorkspace(flags);
workspace.addURIHandler(VMURIHandler.getInstance());
String uri;
// if ((flags & Distributed.FLAG_SEPARATE_JVMS) == 0)
uri = "vm:///object";
// else
// uri = "tcp://localhost:8080/object";
workspace.resolve(uri).getAsync(new AsyncCallback