JDBC / CATATAN</>↗JDBC22 Mei 2010
The Statement.setQueryTimeout() method set the limit in seconds for query execution time. The execution has no timeout limit when the value is set to zero. package org.kodejava.jdbc; import java.sql.Connection; import java.sql.ResultSet; import java.sql.Statement; import java.sql.SQLException; import java.sql.DriverManager; public class QueryTimeout { private static final String URL = "jdbc:mysql://localhost/kodejava"; private static final String USERNAME = "kodejava"; […]
CORE API / CATATAN</>↗Core API22 Mei 2010
package org.kodejava.lang.management; import java.lang.management.ManagementFactory; import java.lang.management.ThreadMXBean; public class PeakThreadCount { public static void main(String[] args) { // Get the managed bean for the thread system of the Java // virtual machine. ThreadMXBean bean = ManagementFactory.getThreadMXBean(); // Get the peak live thread count since the Java virtual // machine started or peak was reset. int peakThreadCount […]
CORE API / CATATAN</>↗Core API21 Mei 2010
package org.kodejava.lang.management; import java.lang.management.ManagementFactory; import java.lang.management.ThreadMXBean; public class ThreadCount { public static void main(String[] args) { // Get the managed bean for the thread system of the Java // virtual machine. ThreadMXBean bean = ManagementFactory.getThreadMXBean(); // Get the current number of live threads including both // daemon and non-daemon threads. int threadCount = bean.getThreadCount(); System.out.println...
CORE API / CATATAN</>↗Core API18 Mei 2010
The RuntimeMXBean.getClassPath() returns the Java class path that is used by the system class loader to search for class files. This method is equivalent to System.getProperty("java.class.path"). Multiple paths in the Java class path are separated by the path separator character of the platform of the Java virtual machine being monitored. package org.kodejava.lang.management; import java.lang.management.ManagementFactory; import […]
CORE API / CATATAN</>↗Core API17 Mei 2010
package org.kodejava.lang.management; import java.lang.management.ManagementFactory; import java.lang.management.RuntimeMXBean; import java.util.Map; import java.util.Set; public class GetSystemProperties { public static void main(String[] args) { RuntimeMXBean bean = ManagementFactory.getRuntimeMXBean(); // Returns a map of names and values of all system // properties. This method calls System.getProperties() // to get all system properties. Properties whose // name or value...
CORE API / CATATAN</>↗Core API14 Mei 2010
package org.kodejava.lang.management; import java.lang.management.ManagementFactory; import java.lang.management.RuntimeMXBean; import java.util.Date; public class GetStartTime { public static void main(String[] args) { RuntimeMXBean bean = ManagementFactory.getRuntimeMXBean(); // Returns the start time of the Java virtual machine in // milliseconds. This method returns the approximate time // when the Java virtual machine started. long startTime = bean.getStartTime(); Date s...