|
SoloSunglasses |
|
|
Hit Counter |
|
Visitors: 254534
|
|
Welcome to J2EEWorld.com
|
Written by Java boy
|
|
Wednesday, 26 January 2005 |
|
Recently, I was doing a task would should avoid multiple transactions coming from different servers interfere each other. Since we also require to record the time of the task, I proposed using Oracle Timestamp type to keep the data integrity of multiple transactions.
Below table was introduced to keep the Server_status
| SERVER_NAME |
LAST_PROCESS_TIME |
JOB_NAME
|
The pseudo SQL statement which ensures the data integrity of the hold back order transaction as below:
UPDATE SERVER_STATUS
SET LAST_PROCESS_TIME = LOCALTIMESTAMP AND
SERVER_NAME= my_server_name
WHERE
LOCALTIMESTAMP - last_process_time > 1 minute AND
TASK_NAME =”my_task”
COMMIT
IF updated_record_number != 0 THEN
//the above logic is to avoid too many overlapping transactions, which could possibly consuming DB resources
BEGIN TRANSACTION
GET last_process_time
//do my job here
//below SQL script is to ensure any transactions that longer than 1 min will be failed if there’s another server already //executed the transaction successfully
SELECT * from SERVER_STATUS FOR UPDATE of LAST_PROCESS_TIME nowait
UPDATE SERVER_STATUS
SET LAST_PROCESS_TIME = LOCALTIMESTAMP AND
SERVER_NAME= my_server_name
WHERE
LAST_PROCESS_TIME = last_process_time AND
SYSDATE - last_process_time > 1 minute AND
TASK_NAME =”Hold_back_order”
IF updated_record_number == 0 THEN
DO ROLLBACK
ELSE
DO COMMIT
END TRANSACTION
The executeUpdate() method will return the number of record set that has been updated. If the number is zero, which means another application server is already processing the transaction, then this server just ignore current transaction; otherwise it shall continue the process hold back order transaction.
some sample code as below for reference. Note, the compare of timestamp is a bit tricky.
static String TIMESTAMP_FORMAT = "dd-mon-yyyy HH.MI.SSXFF PM";
con = DriverManager.getConnection( "jdbc:oracle:thin:@myserver:myport:dbname", USERNAME, PASSWORD);
Statement stmt = con.createStatement();
con.setAutoCommit(false);
ResultSet rs = stmt.executeQuery("SELECT TO_CHAR(LAST_PROCESS_TIME, '" + TIMESTAMP_FORMAT + "') last_time from server_status"); if (rs.next()) last_time = rs.getString("LAST_TIME"); for (int i=0; i<count; i++) { stmt.executeUpdate("UPDATE TEST SET TEST_VALUE=TEST_VALUE+1"); } stmt.executeUpdate("select * from Server_status FOR UPDATE of LAST_PROCESS_TIME nowait"); String sql= "update Server_status set LAST_PROCESS_TIME= LOCALTIMESTAMP " + "where LAST_PROCESS_TIME= TO_TIMESTAMP('" + last_time + "', '" + TIMESTAMP_FORMAT+"')"; int ret = stmt.executeUpdate(sql); if (ret == 0) { con.rollback(); } else { con.commit();
reference: http://www.psoug.org/reference/timestamp.html
|
|
|
Written by George Murnock
|
|
Saturday, 01 October 2005 |
Having robust, automated tests running against your Web applications will help you find defects before they reach your production environment. They'll also allow you to implement your fixes and updates quickly, confident that there were no unintended "side-effects" to your changes.
This article describes how to create, execute, and automate Web application tests using HttpUnit, an open-source, request/response-based testing tool built upon the JUnit test framework. We will cover how to use it, some of its limitations, and some advanced practices as they apply to Portal testing. This tutorial assumes basic familiarity with JUnit.
Click here to view the whole article |
|
|
Written by Aftab Mehmood
|
|
Friday, 12 August 2005 |
|
IBM beats Microsoft in developer prouductivity tools. Read out the following article and post your comments.
http://www.branhamgroup.com/tools_study
|
|
Read more...
|
|
|
Written by Linux lover
|
|
Friday, 17 June 2005 |
|
With more and more J2EE applications designed and developed on Linux box, I felt it's really a need for me to have an in-depth knowledge about the Linux file system structures. Having browsed quite a few reference about this issue, I extracted below content as the key points to learn Linux file system structures. Hope it's also helpful to all Linux lovers :) |
|
Read more...
|
|
|
Written by Opensource lover
|
|
Monday, 13 June 2005 |
|
Creating a new connection for each user can be time consuming (often requiring multiple seconds of clock time), in order to perform a database transaction that might take milliseconds. Opening a connection per user can be unfeasible in a publicly-hosted Internet application where the number of simultaneous users can be very large. Accordingly, developers often wish to share a "pool" of open connections between all of the application's current users. The number of users actually performing a request at any given time is usually a very small percentage of the total number of active users, and during request processing is the only time that a database connection is required. The application itself logs into the DBMS, and handles any user account issues internally.
There are several Database Connection Pools already available, both within Jakarta products and elsewhere. This Commons package provides an opportunity to coordinate the efforts required to create and maintain an efficient, feature-rich package under the ASF license.
The commons-dbcp package relies on code in the commons-pool package to provide the underlying object pool mechanisms that it utilizes.
Applications can use the commons-dbcp component directly or through the existing interface of their container / supporting framework. For example the Tomcat servlet container presents a DBCP DataSource as a JNDI Datasource. James (Java Apache Mail Enterprise Server) has integrated DBCP into the Avalon framework. A Avalon-style datasource is created by wrapping the DBCP implementation. The pooling logic of DBCP and the configuration found in Avalon's excalibur code is what was needed to create an integrated reliable DataSource.
A beneficial to desktop developer is DBCP doesn't require a web or app server!
For more informaiton, check http://jakarta.apache.org/commons/dbcp/ |
|
Last Updated ( Monday, 13 June 2005 )
|
|
|
Written by joe
|
|
Friday, 01 April 2005 |
|
Amentra, an industry leading business and technology consulting firm, today announced it has joined the JBoss Authorized Service Partner (JASP) program and will provide technical support for customers deploying on JBoss Application Server. As a JASP, Amentra will collaborate with JBoss. to provide enterprise-level services, such as training, consulting and custom programming, for Amentra customers.
The move to provide a full array of support and services for Amentra customers using the open source JBoss Application Server reinforces Amentra's strategy of offering customers a range of open source alternatives and support for all market-leading platforms.
"Amentra's partnership with JBoss is a natural extension of our business strategy to deliver the highest quality service-oriented business and technology solutions utilizing both our signature mentoring and outsourced approaches for our clients. This partnership also provides an additional, market-leading deployment platform to help our customers further define an enterprise execution strategy," said Mike Hurt, Amentra vice president of operations. "This relationship enhances Amentra's ability to further leverage our industry acclaimed technology migration approach in moving clients from legacy or other component architectural platforms by utilizing open source as a viable alternative for organizations that want to take advantage of the flexibility provided by these products."
Tom Leonard, vice president of channels, JBoss, said, "We are pleased to welcome Amentra to our growing network of authorized service partners. With its expertise in providing business and technology solutions and deep understanding of the Web services and SOA market, Amentra will be a valuable resource for our joint customers. Amentra's strong commitment to JBoss open source middleware will help drive the adoption of open source to enterprises across all industries."
for more detail, check: http://www.sys-con.com/story/?storyid=48924&DE=1 |
|
|
Written by J2EE blog
|
|
Friday, 01 April 2005 |
|
Sun announced the latest version of Sun Java System Instant Messaging, a key component of Sun Java Communications Suite. With this latest release, Sun is supporting the eXtensible Messaging and Presence Protocol (XMPP), the first protocol to be approved by the Internet Engineering Task Force (IETF) as an Internet standard for instant messaging and presence technologies. In addition, Sun Java System Instant Messaging includes new privacy controls, significant improvements in usability and new partnerships to enhance the offering.
"Instant messaging and presence awareness are powerful communication and collaboration tools, not only as standalone applications but also as the foundation for a wide-range of real-time applications. Through new support for XMPP, Sun Java System Instant Messaging helps to enable customers to build or extend their real time applications to accelerate business processes and increase the return on investment," said Mayank Choudhary, group marketing manager for collaboration products, at Sun.
XMPP facilitates interoperability across instant messaging and real-time, presence-based applications, as well as facilitating third-party integration. Using XMPP, Sun Java System Instant Messaging can help customers protect their communications infrastructure investments by enabling the software to be customized to meet business requirements. XMPP extends the benefits of Sun Java System Instant Messaging by increasing the possible community of users, further reducing the costs of communication, and expanding the potential for instant messaging and presence functionality both through open source components and third party software.
Sun is working with Clique Communications, a leading provider of video communication and collaboration tools to integrate Sun Java System Instant Messaging with Clique Video Messenger. Clique offers modular, component-based solutions that are interoperable across mobile and wireline networks. Customers using Sun Java System Instant Messaging along with Clique Video Messenger, will now be able to incorporate video calling into their communication infrastructure.
"Sun's support of XMPP makes the Sun Java Communications Suite an ideal platform for our video phone, messaging, and conferencing products" said Chang Feng, CTO, Clique Communications, LLC. "XMPP-based presence and messaging allows customers to make video calls more conveniently and effectively. Unlike using an ordinary phone, we can tell that the other person is available before we call them, and we can see them when they answer."
The new release of Sun Java System Instant Messaging helps customers address the issues of privacy and regulatory compliance with extensive privacy controls and partner integrations. Access permissions and a sophisticated set of privacy profile controls enable users to control information about their presence and availability. Because industry regulations require instant messaging to be treated in the same manner as e-mail communications and subject to the same record retention and audit policies, these capabilities are critical for companies looking to meet regulatory compliance requirements.
Check details at: http://www.sys-con.com/story/?storyid=48943&de=1 |
|
| | << Start < Prev 1 2 3 4 5 6 Next > End >>
| | Results 1 - 11 of 56 | |
|
Who's Online |
Warning: Invalid argument supplied for foreach() in /home/httpd/vhosts/j2eeworld.com/httpdocs/modules/mod_whosonline.php on line 32
|
|
HealthXP |
|
|