1 21 package org.apache.derbyTesting.functionTests.tests.derbynet; 22 23 import org.apache.derby.drda.NetworkServerControl; 24 import org.apache.derby.tools.ij; 25 26 import java.util.Properties ; 27 import java.sql.*; 28 import java.util.Vector ; 29 import java.util.Properties ; 30 33 34 public class getCurrentProperties 35 { 36 private static final String DERBY_SYSTEM_HOME = System.getProperty("derby.system.home"); 37 38 private static Properties properties = new java.util.Properties (); 39 private static Object joinsync = new Object (); 40 private static boolean start = false; 41 public static void main (String args[]) throws Exception 42 { 43 try 44 { 45 NetworkServerControl server = new NetworkServerControl(); 46 Properties p = server.getCurrentProperties(); 47 p.list(System.out); 48 ij.getPropertyArg(args); 49 50 startConnection(); 52 joinwait(); 54 server.trace(3, true); 57 server.logConnections(true); 59 System.out.println("Properties with tracing on"); 61 p = server.getCurrentProperties(); 62 p.list(System.out); 63 server.trace(true); 65 server.setTraceDirectory(DERBY_SYSTEM_HOME); 67 System.out.println("Properties with tracing on"); 69 p = server.getCurrentProperties(); 70 p.list(System.out); 71 joinsignal(); 72 } 73 catch (Exception e) 74 { 75 e.printStackTrace(); 76 } 77 } 78 79 private static void startConnection() 80 { 81 Runnable service = new Runnable () { 82 public void run() { 83 try { 84 Connection conn = ij.startJBMS(); 85 86 joinsignal(); 88 joinwait(); 89 } 90 catch (Exception e) { 91 throw new RuntimeException (e.getMessage()); 92 } 93 } 94 }; 95 new Thread (service).start(); 96 } 97 private static void joinwait() 98 { 99 synchronized(joinsync) 100 { 101 while(!start) 102 { 103 try 104 { 105 joinsync.wait(); 106 } 107 catch(InterruptedException ie) 108 { 109 ie.printStackTrace(); 110 } 111 } 112 start = false; 113 } 114 } 115 private static void joinsignal() throws InterruptedException 116 { 117 synchronized(joinsync) 118 { 119 start = true; 120 joinsync.notifyAll(); 121 } 122 Thread.yield(); 123 Thread.sleep(10000); 124 } 125 } 126 127 128 | Popular Tags |