Tag Archives: java

create glassfish jdbc resource

#!/bin/bash
# Shell script to create the GlassFish 4 JDBC Connection pool for Mysql

# http://stackoverflow.com/questions/6572895/how-can-i-create-a-mysql-connection-pool-using-asadmin-tool-in-glassfish-server
echo "Create JDBC connection pool"
asadmin create-jdbc-connection-pool \
--datasourceclassname \
com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource \
--restype javax.sql.DataSource \
--property User=arquillian:Password=arquillian:URL=\"jdbc:mysql://localhost:3306/arquillian\" \
ArquillianPool

# An alternative command line
# asadmin create-jdbc-connection-pool --datasourceclassname com.mysql.jdbc.jdbc2.optional.MysqlDataSource --restype javax.sql.DataSource
# --property user=root:password=test:DatabaseName=test:ServerName=localhost:port=3306 test-pool

echo "Create JDBC resource"
asadmin create-jdbc-resource --connectionpoolid ArquillianPool jdbc/arquillian

java – jre vs jdk

JRE
(Java Runtime Environment)

Computer users who run applets and applications written using Java technology
An environment required to run applets and applications written using the Java programming language
It is an implementation of the Java Virtual Machine* which actually executes Java programs.
Java Runtime Environment is a plug-in needed for running java programs.
The JRE is smaller than the JDK so it needs less Disk space.
It includes the JVM , Core libraries and other additional components to run applications and applets written in Java.

Java SE
(Java Platform, Standard Edition)

Software developers who write applets and applications using Java technology
A software development kit used to write applets and applications using the Java programming language

JDK
(Java Development Kit)
It is a bundle of software that you can use to develop Java based applications.
Java Development Kit is needed for developing java applications.
The JDK needs more Disk space as it contains the JRE along with various development tools.
It includes the JRE, set of API classes, Java compiler, Webstart and additional files needed to write Java applets and applications.

java resources usage

The goal of JavaMelody is to monitor Java or Java EE application servers in QA and production environments. It is not a tool to simulate requests from users, it is a tool to measure and calculate statistics on real operation of an application depending on the usage of the application by users.

JavaMelody is opensource (LGPL) and production ready: in production in an application of 25 person years. JavaMelody is easy to integrate in most applications and is lightweight (no profiling and no database).

JavaMelody is mainly based on statistics of requests and on evolution charts.

It allows to improve applications in QA and production and helps to:

give facts about the average response times and number of executions
make decisions when trends are bad, before problems become too serious
optimize based on the more limiting response times
find the root causes of response times
verify the real improvement after optimizations
It includes summary charts showing the evolution over time of the following indicators:

Number of executions, mean execution times and percentage of errors of http requests, sql requests, jsf actions, struts actions, jsp pages or methods of business façades (if EJB3, Spring or Guice)
Java memory
Java CPU
Number of user sessions
Number of jdbc connections
These charts can be viewed on the current day, week, month, year or custom period.

JavaMelody includes statistics of predefined counters (currently http requests, sql requests, jsf actions, struts actions, jsp pages and methods of business façades if EJB3, Spring or Guice) with, for each counter :

A summary indicating the overall number of executions, the average execution time, the cpu time and the percentage of errors.
And the percentage of time spent in the requests for which the average time exceeds a configurable threshold.
And the complete list of requests, aggregated without dynamic parameters with, for each, the number of executions, the mean execution time, the mean cpu time, the percentage of errors and an evolution chart of execution time over time.
Furthermore, each http request indicates the size of the flow response, the mean number of sql executions and the mean sql time.
It also includes statistics on http errors, on warnings and errors in logs, on data caches if ehcache and on batch jobs if quartz.

https://code.google.com/p/javamelody/

java GCJ

OpenJDK’s native Java compiler is, itself, written in Java; as a consequence, you need a working previous version of Java in order to build a new version.

If you’re starting from scratch on a platform for which no existing JDK binaries are readily available (or if you’re working within certain Free Software projects whose charters prohibit the use of proprietary build dependencies), then GCJ (or some of its underlying components) can be one potential solution to the chicken-and-egg problem of getting a working, albeit somewhat inefficient bootstrap Java in place, in order to move on to build the more desirable OpenJDK.

In fact, back when OpenJDK was first announced, significant effort (via the IcedTea project) was spent in fixing up GCJ to get it to the point where it was up to the task.

GCJ is obsolete. It was started a long time ago because people wanted an open-source alternative to the Sun JDK, and it was never particularly good. Now that Sun open-sourced their JDK, there’s absolutely no reason to use GCJ (but it still lurks in some Linux distros).