Examples of SCServer


Examples of com.shop.cache.api.server.SCServer

     * CCDB2 package to do this
     */
    SCStorage         db = CCDB2StorageFactory.create(new CCDB2Parameters());
    db.open(getFileFromPath(arguments.dbPath));

    /**
     * Everything's set up, we can now create the server
     */
    final SCServer       server = factory.newServer(context, db);

    /**
     * Set up a hook to handle CTRL-C shutdown requests
     */
    Thread           hook = new Thread
    (
      new Runnable()
      {
        @Override
        public void run()
        {
          System.out.println("Shutting down...");
          server.shutdown();
        }
      }
    );
    hook.setDaemon(true);
    Runtime.getRuntime().addShutdownHook(hook);

    /**
     * sleep until the server process is done
     */
    server.join();
    System.out.println("Done.");
  }
 
View Full Code Here

Examples of org.serviceconnector.api.srv.SCServer

  public void run() {

    List<String> nics = new ArrayList<String>();
    nics.add("localhost");

    SCServer sc = new SCServer("localhost", 9000, nics, 9001, ConnectionType.DEFAULT_SERVER_CONNECTION_TYPE);

    try {
      sc.setKeepAliveIntervalSeconds(10); // can be set before register
      sc.setImmediateConnect(true); // can be set before register
      sc.startListener(); // regular

      String serviceName = "publish-1";
      SCPublishServer publishSrv = sc.newPublishServer(serviceName);
      try {

        int maxSessions = 10;
        int maxConnections = 5;
        SCPublishServerCallback cbk = new SrvCallback(publishSrv);

        publishSrv.register(maxSessions, maxConnections, cbk);
      } catch (Exception e) {
        publishSrv.deregister();
        throw e;
      }
    } catch (Exception e) {
      LOGGER.error("runPublishServer", e);
      sc.stopListener();
      sc.destroy();
    }
  }
View Full Code Here

Examples of org.serviceconnector.api.srv.SCServer

        this.scPublishServer.deregister();
        ;
      } catch (Exception e) {
        LOGGER.error("run", e);
      } finally {
        SCServer sc = this.scPublishServer.getSCServer();
        sc.stopListener();
        sc.destroy();
      }
    }
View Full Code Here

Examples of org.serviceconnector.api.srv.SCServer

   * Description:  publish 100000 compressed messages � 128 bytes to the server.<br>
   * Expectation:  passes
   */
  @Test
  public void publish_100000_msg_compressed() throws Exception {
    server = new SCServer(TestConstants.HOST, TestConstants.PORT_SC0_TCP, TestConstants.PORT_PUB_SRV_TCP, ConnectionType.NETTY_TCP);
    server.startListener();
    publishServer = server.newPublishServer(TestConstants.pubServiceName1);
    SCPublishServerCallback cbk = new PubSrvCallback(publishServer);
    publishServer.register(10, 2, cbk);
    SCPublishMessage publishMessage = new SCPublishMessage(new byte[128]);
View Full Code Here

Examples of org.serviceconnector.api.srv.SCServer

   * Description:  publish 100000 uncompressed messages � 128 bytes to the server.<br>
   * Expectation:  passes
   */
  @Test
  public void publish_100000_msg_uncompressed() throws Exception {
    server = new SCServer(TestConstants.HOST, TestConstants.PORT_SC0_TCP, TestConstants.PORT_PUB_SRV_TCP, ConnectionType.NETTY_TCP);
    server.startListener();
    publishServer = server.newPublishServer(TestConstants.pubServiceName1);
    SCPublishServerCallback cbk = new PubSrvCallback(publishServer);
    publishServer.register(10, 2, cbk);
    SCPublishMessage publishMessage = new SCPublishMessage(new byte[128]);
View Full Code Here

Examples of org.serviceconnector.api.srv.SCServer

  public void run() {

    List<String> nics = new ArrayList<String>();
    nics.add("localhost");

    SCServer sc = new SCServer("localhost", 9000, nics, 9002, ConnectionType.DEFAULT_SERVER_CONNECTION_TYPE);

    try {
      sc.setKeepAliveIntervalSeconds(10); // can be set before register
      sc.setImmediateConnect(true); // can be set before register
      sc.startListener(); // regular

      String serviceName = "session-1";
      SCSessionServer server = sc.newSessionServer(serviceName); // no other params possible
      int maxSess = 100;
      int maxConn = 10;
      SCSessionServerCallback cbk = newSrvCallback(server);
      try {
        server.register(maxSess, maxConn, cbk); // regular
        // server.registerServer(10, maxSess, maxConn, cbk); //
        // alternative with operation timeout
      } catch (Exception e) {
        LOGGER.error("runSessionServer", e);
        server.deregister();
        throw e;
      }
    } catch (Exception e) {
      LOGGER.error("runSessionServer", e);
      sc.stopListener();
      sc.destroy();
    }
  }
View Full Code Here

Examples of org.serviceconnector.api.srv.SCServer

        Thread.sleep(200);
        this.server.deregister();
      } catch (Exception e) {
        LOGGER.error("run", e);
      } finally {
        SCServer sc = server.getSCServer();
        sc.stopListener();
        sc.destroy();
      }
    }
View Full Code Here

Examples of org.serviceconnector.api.srv.SCServer

  public void run() {

    List<String> nics = new ArrayList<String>();
    nics.add("localhost");

    SCServer sc = new SCServer("localhost", 9000, nics, 9002, ConnectionType.DEFAULT_SERVER_CONNECTION_TYPE);

    try {
      sc.setKeepAliveIntervalSeconds(10); // can be set before register
      sc.setImmediateConnect(true); // can be set before register
      sc.startListener(); // regular

      String serviceName = "session-1";
      SCSessionServer server = sc.newSessionServer(serviceName); // no other params possible
      int maxSess = 100;
      int maxConn = 10;
      SCSessionServerCallback cbk = newSessionSrvCallback(server);
      try {
        server.register(maxSess, maxConn, cbk); // regular
        // server.registerServer(10, maxSess, maxConn, cbk); //
        // alternative with operation timeout
      } catch (Exception e) {
        LOGGER.error("runSessionServer", e);
        server.deregister();
        throw e;
      }
    } catch (Exception e) {
      LOGGER.error("runSessionServer", e);
      sc.stopListener();
      sc.destroy();
    }

    try {
      String serviceName = "cacheGuardian1";
      SCPublishServer server = sc.newPublishServer(serviceName);
      int maxSess = 100;
      int maxConn = 10;
      SCPublishServerCallback cbk = newPublishSrvCallback(server);
      try {
        server.register(maxSess, maxConn, cbk); // regular
        // server.registerServer(10, maxSess, maxConn, cbk); //
        // alternative with operation timeout
      } catch (Exception e) {
        LOGGER.error("runSessionServer", e);
        server.deregister();
        throw e;
      }
    } catch (Exception e) {
      LOGGER.error("runSessionServer", e);
      sc.stopListener();
      sc.destroy();
    }
  }
View Full Code Here

Examples of org.serviceconnector.api.srv.SCServer

        Thread.sleep(200);
        this.server.deregister();
      } catch (Exception e) {
        LOGGER.error("run", e);
      } finally {
        SCServer sc = server.getSCServer();
        sc.stopListener();
        sc.destroy();
      }
    }
View Full Code Here

Examples of org.serviceconnector.api.srv.SCServer

   * Description: Invoke SCServer constructor with host, port and listener port. <br>
   * Expectation: Host, Port and listener Port was set
   */
  @Test
  public void t01_constructor() throws Exception {
    server = new SCServer(TestConstants.HOST, TestConstants.PORT_SC0_TCP, TestConstants.PORT_SES_SRV_TCP);
    Assert.assertEquals("Host not equal", TestConstants.HOST, server.getSCHost());
    Assert.assertEquals("Port not equal", TestConstants.PORT_SC0_TCP, server.getSCPort());
    Assert.assertEquals("Listener Port not equal", TestConstants.PORT_SES_SRV_TCP, server.getListenerPort());
    Assert.assertEquals("Default ConnectionType not set", ConnectionType.DEFAULT_SERVER_CONNECTION_TYPE, server
        .getConnectionType());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.