SupportWriter space ↗
REFERENCE LIBRARY

References from other publishers

Republished articles with source attribution. This collection is separate from Diary Coding’s original guides and does not display ads.

Read original guides → · Editorial policy

FOR YOUR CURIOSITY

Latest notes.

CORE API / NOTES</>↗
Core API14 Aug 2011

How do I get number of active thread group?

Use method activeGroupCount() of ThreadGroup class to get estimate number of active groups in the thread group and use activeCount() to get estimate number of active threads in a thread group. package org.kodejava.lang; public class ActiveGroupCount { public static void main(String[] args) { ThreadGroup root = new ThreadGroup("RootGroup"); ThreadGroup server = new ThreadGroup(root, "ServerGroup"); ThreadGroup […]

Wayan · 2 min read
CORE API / NOTES</>↗
Core API14 Aug 2011

How do I get thread group of a thread?

Use the getThreadGroup() method of Thread class to get the thread group to which the thread belongs. package org.kodejava.lang; public class GetThreadGroup { public static void main(String[] args) { // Create thread groups ThreadGroup group = new ThreadGroup("ThreadGroup"); ThreadGroup anotherGroup = new ThreadGroup(group, "AnotherGroup"); // Create threads and placed into thread group Thread t1 = […]

Wayan · 1 min read
CORE API / NOTES</>↗
Core API14 Aug 2011

How do I get the state of a thread?

To get the state of a thread use getState() method of a Thread class. One thing to be noted is that this method is designed for use in monitoring of the system state, not for synchronization control. package org.kodejava.lang; public class GetThreadState implements Runnable { public static void main(String[] args) { Thread thread = new […]

Wayan · 1 min read
2D API / NOTES</>↗
2D API13 Aug 2011

How do I draw / plot a graph?

This program read a file of data and draw a graph of the data points in the file. The graph is drawn in a window with three sections. The first section contains three buttons that initiate the program’s actions. Actions can also be initiated via control keys. The second section displays the data to be […]

Wayan · 9 min read
APACHE COMMONS / NOTES</>↗
Apache Commons10 Aug 2011

How do I create a BasicDataSource object?

This example demonstrates how to use the BasicDataSource class of Apache Commons DBCP to create a basic requirements for database connection. The configuration of the data source can be defined using some property method provided by this class. The basic properties are the driver classname, connection url, username and password. After the datasource ready we […]

Wayan · 2 min read
APACHE COMMONS / NOTES</>↗
Apache Commons10 Aug 2011

How do I create a database connection pool?

This example shows you how to create a connection pool implementation using the Apache Commons DBCP library. package org.kodejava.commons.dbcp; import org.apache.commons.dbcp2.*; import org.apache.commons.pool2.impl.GenericObjectPool; import org.apache.commons.pool2.impl.GenericObjectPoolConfig; import javax.sql.DataSource; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; public class ConnectionPoolExample { private static final String...

Wayan · 3 min read
✳

Knowledge grows when shared.

Stay curious. There is always something new to learn.

Explore notes ↗
Putu Adi Guna Permana
ABOUT THE AUTHOR

Dr (C). Ir. Putu Adi Guna Permana, S.Kom., M.Kom., IPM., ASEAN Eng.

Writer and founder of Diary Coding — sharing notes, tutorials, and experiences about programming for anyone who wants to keep learning.