当前位置: 首页>>代码示例>>Java>>正文


Java NetworkServerControl.shutdown方法代码示例

本文整理汇总了Java中org.apache.derby.drda.NetworkServerControl.shutdown方法的典型用法代码示例。如果您正苦于以下问题:Java NetworkServerControl.shutdown方法的具体用法?Java NetworkServerControl.shutdown怎么用?Java NetworkServerControl.shutdown使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.derby.drda.NetworkServerControl的用法示例。


在下文中一共展示了NetworkServerControl.shutdown方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testTransactionalBehaviourOfAsyncEventListener_1

import org.apache.derby.drda.NetworkServerControl; //导入方法依赖的package包/类
public void testTransactionalBehaviourOfAsyncEventListener_1()
    throws Exception {
  Connection derbyConn = null;
  Statement derbyStmt = null;
  NetworkServerControl server = null;
  try {
    server = startNetworkServer();
    createDerbyValidationArtefacts();
    String derbyDbUrl = "jdbc:derby://"
        + InetAddress.getLocalHost().getHostName() + ':' + this.netPort
        + "/newDB;create=true;";
    if (TestUtil.currentUserName != null) {
      derbyDbUrl += ("user=" + TestUtil.currentUserName + ";password="
          + TestUtil.currentUserPassword + ';');
    }
    derbyConn = DriverManager.getConnection(derbyDbUrl);
    // create schema
    derbyStmt = derbyConn.createStatement();
    // Create the controller VM as client which belongs to default server
    // group
    startClientVMs(1, 0, null);
    startServerVMs(1, -1, "SG1");
    // create table
    clientSQLExecute(1, "create table TESTTABLE (ID int not null "
        + "primary key, DESCRIPTION varchar(1024), ADDRESS varchar(1024), "
        + "ID1 int) AsyncEventListener (WBCL1)");

    Runnable runnable = getExecutorForWBCLConfiguration("SG1", "WBCL1",
        TXAsyncEventListener.class.getName(), null, derbyDbUrl, true,
        Integer.valueOf(1), null, Boolean.FALSE, null, null, null, 100000,
        null, false);
    runnable.run();
    Runnable startWBCL = startAsyncEventListener("WBCL1");
    clientExecute(1, startWBCL);
    Connection conn = TestUtil.jdbcConn;
    conn.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
    conn.setAutoCommit(false);
    Statement stmt = conn.createStatement();
    // Do an insert in sql fabric. This will create a primary bucket on the
    // lone server VM with bucket ID =1

    stmt.executeUpdate("Insert into TESTTABLE values(114,'desc114','Add114',114)");

    stmt.executeUpdate("Insert into TESTTABLE values(1,'desc1','Add1',1)");
    stmt.executeUpdate("Insert into TESTTABLE values(227,'desc227','Add227',227)");
    stmt.executeUpdate("Insert into TESTTABLE values(340,'desc340','Add340',340)");
    conn.rollback();
    stmt.executeUpdate("Insert into TESTTABLE values(114,'desc114','Add114',114)");
    // Insert some more rows in gemfirexd
    stmt.executeUpdate("Insert into TESTTABLE values(1,'desc1','Add1',1)");
    stmt.executeUpdate("Insert into TESTTABLE values(2,'desc1','Add1',1)");
    stmt.executeUpdate("Insert into TESTTABLE values(224,'desc227','Add227',227)");
    stmt.executeUpdate("Insert into TESTTABLE values(331,'desc340','Add340',340)");
    conn.commit();
    // Bulk Update
    stmt.executeUpdate("update TESTTABLE set ID1 = ID1 +1 ");
    conn.rollback();
    // PK delete
    stmt.executeUpdate("delete from TESTTABLE where ID = " + DELETED_KEY);
    conn.commit();
    blockForValidation();
    stopAsyncEventListener("WBCL1").run();
    validateResults(derbyStmt, "select * from testtable", this.netPort, true);
  } finally {
    cleanDerbyArtifacts(derbyStmt, new String[] { "validateTestEnd" },
        new String[] { "test_ok" }, new String[] { "TESTTABLE" }, derbyConn);
    // might get ShutdownExceptions in derby connection close
    addExpectedDerbyException(ShutdownException.class.getName());
    try {
      DriverManager.getConnection("jdbc:derby:;shutdown=true");
    } catch (SQLException sqle) {
      if (sqle.getMessage().indexOf("shutdown") == -1) {
        sqle.printStackTrace();
        throw sqle;
      }
    }
    if (server != null) {
      server.shutdown();
    }
  }
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:82,代码来源:SerialDBSynchronizerPart2DUnit.java

示例2: testDBSynchronizerPRWithSynchronizerOnNonRedundantDataStoreAndDMLOnAccessor

import org.apache.derby.drda.NetworkServerControl; //导入方法依赖的package包/类
public void testDBSynchronizerPRWithSynchronizerOnNonRedundantDataStoreAndDMLOnAccessor()
    throws Exception {
  Statement derbyStmt = null;
  Connection derbyConn = null;
  NetworkServerControl server = null;
  try {
    String derbyDbUrl = "jdbc:derby://"
        + InetAddress.getLocalHost().getHostName() + ':' + this.netPort
        + "/newDB;create=true;";
    if (TestUtil.currentUserName != null) {
      derbyDbUrl += ("user=" + TestUtil.currentUserName + ";password="
          + TestUtil.currentUserPassword + ';');
    }
    server = startNetworkServer();
    createDerbyValidationArtefacts();
    derbyConn = DriverManager.getConnection(derbyDbUrl);
    // create schema
    derbyStmt = derbyConn.createStatement();
    // Create the controller VM as client which belongs to default server
    // group
    startClientVMs(1, 0, null);
    startServerVMs(3, -1, "SG1");
    // create table
    clientSQLExecute(1,
        "create table TESTTABLE (ID int not null primary key, "
            + "DESCRIPTION varchar(1024) , ADDRESS varchar(1024), ID1 int) server groups(SG1) redundancy 1");
           // + "AsyncEventListener (WBCL1)");

    clientSQLExecute(1, "alter table TESTTABLE set AsyncEventListener (WBCL1)");

    Runnable runnable = getExecutorForWBCLConfiguration("SG1", "WBCL1",
        "com.pivotal.gemfirexd.callbacks.DBSynchronizer",
        "org.apache.derby.jdbc.ClientDriver", derbyDbUrl + ",app,app", true,
        Integer.valueOf(1), null, Boolean.FALSE, null, null, null, 100000, "", false);
    runnable.run();
    Runnable startWBCL = startAsyncEventListener("WBCL1");
    clientExecute(1, startWBCL);
    pause(5000);
    // Do an insert in sql fabric
    clientSQLExecute(1, "Insert into TESTTABLE values(1,'desc1','Add1',1)");
    clientSQLExecute(1, "Insert into TESTTABLE values(2,'desc2','Add2',2)");
    clientSQLExecute(1, "Insert into TESTTABLE values(3,'desc3','Add3',3)");
    clientSQLExecute(1, "Insert into TESTTABLE values(4,'desc4','Add4',4)");
    clientSQLExecute(1, "Insert into TESTTABLE values(5,'desc5','Add5',5)");
    clientSQLExecute(1, "Insert into TESTTABLE values(6,'desc6','Add6',6)");
    // Bulk Update
    clientSQLExecute(1, "update TESTTABLE set ID1 = ID1 +1 ");

    // Bulk Delete
    clientSQLExecute(1, "delete from testtable where ADDRESS = 'Add5'");
    clientSQLExecute(1, "delete from TESTTABLE where ID = " + DELETED_KEY);
    blockForValidation();
    stopAsyncEventListener("WBCL1").run();
    Thread.sleep(5000);
    validateResults(derbyStmt, "select * from testtable", this.netPort, true);
  }
  finally {
    cleanDerbyArtifacts(derbyStmt, new String[] {}, new String[] {},
        new String[] { "TESTTABLE" }, derbyConn);
    // might get ShutdownExceptions in derby connection close
    addExpectedDerbyException(ShutdownException.class.getName());
    try {
      DriverManager.getConnection("jdbc:derby:;shutdown=true");
    }
    catch (SQLException sqle) {
      if (sqle.getMessage().indexOf("shutdown") == -1) {
        sqle.printStackTrace();
        throw sqle;
      }
    }
    if (server != null) {
      server.shutdown();
    }
  }
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:76,代码来源:SerialDBSynchronizerPart1DUnit.java

示例3: testBug42430_1

import org.apache.derby.drda.NetworkServerControl; //导入方法依赖的package包/类
public void testBug42430_1() throws Exception {
  Connection derbyConn = null;
  Statement derbyStmt = null;
  Statement stmt = null;
  NetworkServerControl server = null;
  boolean tablesCreated = false;
  try {
    server = startNetworkServer();
    createDerbyValidationArtefacts();
    String derbyDbUrl = "jdbc:derby://"
        + InetAddress.getLocalHost().getHostName() + ':' + this.netPort
        + "/newDB;create=true;";
    if (TestUtil.currentUserName != null) {
      derbyDbUrl += ("user=" + TestUtil.currentUserName + ";password="
          + TestUtil.currentUserPassword + ';');
    }
    derbyConn = DriverManager.getConnection(derbyDbUrl);
    // create schema
    derbyStmt = derbyConn.createStatement();

    startServerVMs(2, -1, "SG1");

    // create table
    serverSQLExecute(1,
        "create table TESTTABLE (ID int not null primary key , "
            + "DESCRIPTION varchar(1024) , ADDRESS varchar(1024), ID1 int ) "
            + "AsyncEventListener (WBCL2) "
            + " partition by range (ID) (VALUES BETWEEN 0 AND 5,  "
            + "VALUES BETWEEN 5  AND 10 , VALUES BETWEEN 10  AND 20 )");

    tablesCreated = true;

    Runnable runnable = getExecutorForWBCLConfiguration("SG1", "WBCL2",
        "com.pivotal.gemfirexd.callbacks.DBSynchronizer",
        "org.apache.derby.jdbc.ClientDriver", derbyDbUrl, true,
        Integer.valueOf(1), null, Boolean.TRUE, null, null, null, 100000, "", false);
    serverExecute(1, runnable);
    Runnable startWBCL = startAsyncEventListener("WBCL2");
    serverExecute(1, startWBCL);
    startClientVMs(1, 0, null);
    Connection conn = TestUtil.jdbcConn;
    stmt = conn.createStatement();
    String str = "insert into TESTTABLE values";
    for (int i = 0; i < 20; ++i) {
      str += "(" + i + ", 'First', 'J 604'," + i + "),";
    }
    str = str.substring(0, str.length() - 1);
    stmt.executeUpdate(str);
    assertEquals(1,
        stmt.executeUpdate("delete from TESTTABLE where ID = " + DELETED_KEY));
    blockForValidation();
    // Now create a dumy client to allow validation
    startClientVMs(1, -1, "SG");
    validateResults(derbyStmt, "select * from testtable", this.netPort, true);
  }
  finally {
    ok = false;
    cleanDerbyArtifacts(derbyStmt, new String[] {}, new String[] {},
        new String[] { "TESTTABLE" }, derbyConn);
    if (tablesCreated) {
      clientSQLExecute(1, "drop table TESTTABLE");
      // derbyStmt.execute("drop procedure validateTestEnd");
    }
    try {
      DriverManager.getConnection("jdbc:derby:;shutdown=true");
    }
    catch (SQLException sqle) {
      if (sqle.getMessage().indexOf("shutdown") == -1) {
        sqle.printStackTrace();
        throw sqle;
      }
    }
    if (server != null) {
      server.shutdown();
    }
  }
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:78,代码来源:SerialDBSynchronizerPart1DUnit.java

示例4: testBug42430_2

import org.apache.derby.drda.NetworkServerControl; //导入方法依赖的package包/类
public void testBug42430_2() throws Exception {
  Connection derbyConn = null;
  Statement derbyStmt = null;
  Statement stmt = null;
  NetworkServerControl server = null;
  boolean tablesCreated = false;
  try {
    server = startNetworkServer();
    createDerbyValidationArtefacts();
    String derbyDbUrl = "jdbc:derby://"
        + InetAddress.getLocalHost().getHostName() + ':' + this.netPort
        + "/newDB;create=true;";
    if (TestUtil.currentUserName != null) {
      derbyDbUrl += ("user=" + TestUtil.currentUserName + ";password="
          + TestUtil.currentUserPassword + ';');
    }
    derbyConn = DriverManager.getConnection(derbyDbUrl);
    // create schema
    derbyStmt = derbyConn.createStatement();

    startServerVMs(2, -1, "SG1");

    // create table
    serverSQLExecute(1,
        "create table TESTTABLE (ID int not null primary key , "
            + "DESCRIPTION varchar(1024) , ADDRESS varchar(1024), ID1 int ) "
            + "AsyncEventListener (WBCL2)  replicate ");

    tablesCreated = true;

    Runnable runnable = getExecutorForWBCLConfiguration("SG1", "WBCL2",
        "com.pivotal.gemfirexd.callbacks.DBSynchronizer",
        "org.apache.derby.jdbc.ClientDriver", derbyDbUrl, true,
        Integer.valueOf(1), null, Boolean.TRUE, null, null, null, 100000, "", false);
    serverExecute(1, runnable);
    Runnable startWBCL = startAsyncEventListener("WBCL2");
    serverExecute(1, startWBCL);
    startClientVMs(1, 0, null);
    Connection conn = TestUtil.jdbcConn;
    stmt = conn.createStatement();
    String str = "insert into TESTTABLE values";
    for (int i = 0; i < 20; ++i) {
      str += "(" + i + ", 'First', 'J 604'," + i + "),";
    }
    str = str.substring(0, str.length() - 1);
    stmt.executeUpdate(str);
    assertEquals(1,
        stmt.executeUpdate("delete from TESTTABLE where ID = " + DELETED_KEY));
    blockForValidation();
    // Now create a dumy client to allow validation
    startClientVMs(1, -1, "SG");
    validateResults(derbyStmt, "select * from testtable", this.netPort, true);
  }
  finally {
    ok = false;
    cleanDerbyArtifacts(derbyStmt, new String[] {}, new String[] {},
        new String[] { "TESTTABLE" }, derbyConn);
    if (tablesCreated) {
      clientSQLExecute(1, "drop table TESTTABLE");
      // derbyStmt.execute("drop procedure validateTestEnd");
    }
    try {
      DriverManager.getConnection("jdbc:derby:;shutdown=true");
    }
    catch (SQLException sqle) {
      if (sqle.getMessage().indexOf("shutdown") == -1) {
        sqle.printStackTrace();
        throw sqle;
      }
    }
    if (server != null) {
      server.shutdown();
    }
  }
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:76,代码来源:SerialDBSynchronizerPart1DUnit.java

示例5: testMemberSetForBulkOpDistributionForPRAndReplicatedTables

import org.apache.derby.drda.NetworkServerControl; //导入方法依赖的package包/类
public void testMemberSetForBulkOpDistributionForPRAndReplicatedTables()
    throws Exception {
  // create three server VMs. Define Gateway Hub on only one server VM.
  // The advise member set should return only one member & should not include
  // self.
  startServerVMs(2, -1, "SG0");
  startServerVMs(1, -1, "SG1");
  startClientVMs(1, 0, null);
  NetworkServerControl nsc = null;
  boolean tablesCreated = false;
  try {
    String derbyDbUrl = "jdbc:derby://"
        + InetAddress.getLocalHost().getHostName() + ':' + this.netPort
        + "/newDB;create=true;";
    if (TestUtil.currentUserName != null) {
      derbyDbUrl += ("user=" + TestUtil.currentUserName + ";password="
          + TestUtil.currentUserPassword + ';');
    }
    nsc = startNetworkServer();
    String tableDef = " create table TESTTABLE1 ( ID int not null primary key , test_bigint BIGINT, "
        + " test_boolean smallint )";
    clientSQLExecute(1, tableDef + "  AsyncEventListener (WBCL2) ");
    tablesCreated = true;
    Runnable runnable = getExecutorForWBCLConfiguration("SG1", "WBCL2",
        "com.pivotal.gemfirexd.callbacks.DBSynchronizer",
        "org.apache.derby.jdbc.ClientDriver", derbyDbUrl, true,
        Integer.valueOf(1), null, Boolean.TRUE, null, null, null, 100000, "", false);
    runnable.run();
    Runnable startWBCL = startAsyncEventListener("WBCL2");
    startWBCL.run();
    final String schemaName = getCurrentDefaultSchemaName();
    validate(schemaName + ".TESTTABLE1");
    // Create a replicated table
    tableDef = " create table TESTTABLE2 ( ID int not null primary key , test_bigint BIGINT, "
        + " test_boolean smallint )";
    clientSQLExecute(1, tableDef + "  replicate AsyncEventListener (WBCL2) ");
    validate(schemaName + ".TESTTABLE2");
  }
  finally {
    if (nsc != null) {
      nsc.shutdown();
    }
    if (tablesCreated) {
      clientSQLExecute(1, "drop table if exists TESTTABLE1");
      clientSQLExecute(1, "drop table if exists TESTTABLE2");
    }
    try {
      DriverManager.getConnection("jdbc:derby:;shutdown=true");
    }
    catch (SQLException sqle) {
      if (sqle.getMessage().indexOf("shutdown") == -1) {
        sqle.printStackTrace();
        throw sqle;
      }
    }
  }
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:58,代码来源:SerialDBSynchronizerPart1DUnit.java


注:本文中的org.apache.derby.drda.NetworkServerControl.shutdown方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。